我正在尝试调用委托(delegate)方法,但不起作用。我的错误在哪里?
这是我声明@protocol、委托(delegate)和方法的类:
#import "EEBaseVC.h"
@protocol EEInterstitialScreenDelegete;
@interface EEInterstitialScreen : EEBaseVC
@property(nonatomic,strong) id <EEInterstitialScreenDelegete> delegete;
@end
@protocol EEInterstitialScreenDelegete <NSObject>
-(void)interstitialScreenUpdateInfo:(EEInterstitialScreen *)interstitialscreen;
@end
这是另一个 ViewController 中委托(delegate)方法的声明:
#pragma mark - EEInterstitialScreenDelegate
-(void)interstitialScreenUpdateInfo:(EEInterstitialScreen *)interstitialscreen
{
NSLog("hello");
}
我必须做一些事情才能在以前的 View Controller 中调用此方法。但 if 条件不满足:
if (_delegete && [_delegete respondsToSelector:@selector(interstitialScreenUpdateInfo:)] ) {
[_delegete interstitialScreenUpdateInfo:self];
}
最佳答案
AnotherViewController * obj = [AnotherViewController alloc]init];
obj.delegate =self;
[self.navigationController pushViewController:obj];
关于Ios:未调用委托(delegate)方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36278225/