[英]Delegate is not calling method
So i have a question . 所以我有一个问题。 Can someone Tell me the Problem with this line of code for calling(protocol) a Method 有人可以告诉我这行代码调用(协议)方法的问题
[self.delegate poplogin];
poplogin is method name , its not working for some reason. poplogin是方法名称,由于某种原因它不起作用。 its not calling the method poplogin 它没有调用方法poplogin
for reference : 以供参考 :
@property(nonatomic,retain) id<loginAuthDelegate> delegate;
So let me Explain the Case 让我解释一下案例
so lets say i have a Class abc.h 所以我要说我有一个班级abc.h
@protocol loginAuthDelegate <NSObject>
-(void)poplogin;
@end
After interface 界面后
@property(nonatomic,retain) id<loginAuthDelegate> delegate;
in .m i am just calling the Delegate and @synthesize it
[self.delegate poplogin];
not i have another files
let say def.h
i am importing the Class abc.h
@interface def : UIViewController<loginAuthDelegate>
def.m
-(void)poplogin
{
NSLog(@"Delegate doesn't respond to here");
vmpaSecureLogin *ivc = [[vmpaSecureLogin alloc] init];
ivc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:ivc animated:YES];
}
This is probably because self.delegate
is nil
. 这可能是因为self.delegate
是nil
。
You probably forgot to affect your object's delegate
to some other object in which you implemented the delegate methods, like your ViewController or something. 您可能忘记影响对象的delegate
给您实现委托方法的其他对象,比如ViewController或其他东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.