[英]How to access delegate method from another class?
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? 有任何想法吗?
try with following code; 尝试以下代码;
BitWiseAppDelegate *appDelegate = (BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate showAddingPersonalDetails];
or 要么
[(BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate] showAddingPersonalDetails];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.