Ios:未调用委托(delegate)方法

标签 ios uiviewcontroller delegates xcode7

我正在尝试调用委托(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/

相关文章:

ios - UICollectionView 方向改变事故?

iphone - 为体系结构 'GCC 4.2' 选择了不受支持的编译器 'armv7'

iphone - 将 iOS GPS 变量输入 JSON/oAUTH 请求

ios - UIViewController removeFromSuperview 错误

iOS IAP 订阅 : Schedule 2 (Section 3. 8(b))

ios - 如何在 phonegap 项目的启动画面后添加 UIViewController?

ios - UIViewController 和自动布局 subview

c# - 委托(delegate)的构造函数和成员函数在哪里定义?

c# - 在 C# 中使用表达式创建通用委托(delegate)

c# - 如何检查 MethodInfo 是否匹配泛型 T 的委托(delegate),其中 T 是 Action 还是 Func?