[英]Delegate is not calling method
所以我有一個問題。 有人可以告訴我這行代碼調用(協議)方法的問題
[self.delegate poplogin];
poplogin是方法名稱,由於某種原因它不起作用。 它沒有調用方法poplogin
以供參考 :
@property(nonatomic,retain) id<loginAuthDelegate> delegate;
讓我解釋一下案例
所以我要說我有一個班級abc.h
@protocol loginAuthDelegate <NSObject>
-(void)poplogin;
@end
界面后
@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];
}
這可能是因為self.delegate
是nil
。
您可能忘記影響對象的delegate
給您實現委托方法的其他對象,比如ViewController或其他東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.