繁体   English   中英

Delegate不是调用方法

[英]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.delegatenil

您可能忘记影响对象的delegate给您实现委托方法的其他对象,比如ViewController或其他东西。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM