如何从另一个类访问委托方法?
我的委托中有一个方法可以执行此操作:
-(void)showAddingPersonalDetails; {
personal = [[AddingPersonalDetails alloc] initWithNibName:@"AddingWithPersonalDetails" bundle:nil];
[window addSubview:personal.view];
[window makeKeyAndVisible];
mainscreen.view.hidden = YES;
NSLog(@"Called");
}
我不希望在需要之前初始化此视图。这就是为什么要放入一个方法。
问题是,我似乎无法从另一个类访问此代码。
我什至尝试过这个:
BitWiseAppDelegate *appDelegate = (BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.showAddingPersonalDetails;
但它不起作用。有什么想法吗?
I have a method in my delegate that does this:
-(void)showAddingPersonalDetails; {
personal = [[AddingPersonalDetails alloc] initWithNibName:@"AddingWithPersonalDetails" bundle:nil];
[window addSubview:personal.view];
[window makeKeyAndVisible];
mainscreen.view.hidden = YES;
NSLog(@"Called");
}
I don't want this view initialized until I need it. That's why put in in a method.
The problem is, I can't seem to access this code from another class.
I even tried this:
BitWiseAppDelegate *appDelegate = (BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.showAddingPersonalDetails;
But it doesn't work. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用以下代码;
或者
try with following code;
or