2016-03-29 21 views
0

デリゲートメソッドを呼び出そうとしていますが、機能していません。私のミスはどこですか?Ios:Delegeteメソッドが呼び出されない

#import "EEBaseVC.h" 

@protocol EEInterstitialScreenDelegete; 

@interface EEInterstitialScreen : EEBaseVC 

@property(nonatomic,strong) id <EEInterstitialScreenDelegete> delegete; 

@end 

@protocol EEInterstitialScreenDelegete <NSObject> 

-(void)interstitialScreenUpdateInfo:(EEInterstitialScreen *)interstitialscreen; 

@end 

そして、これは別のViewControllerでデリゲートメソッドの宣言です:

#pragma mark - EEInterstitialScreenDelegate 

-(void)interstitialScreenUpdateInfo:(EEInterstitialScreen *)interstitialscreen 
{ 
    NSLog("hello"); 
} 

私がする必要がある。ここ

は私が@protocol、デリゲートとメソッドを宣言したクラスです。前のビューコントローラでこのメソッドを呼び出すためにいくつかのことをします。条件が満たされない場合でも:

if (_delegete && [_delegete respondsToSelector:@selector(interstitialScreenUpdateInfo:)]) { 
    [_delegete interstitialScreenUpdateInfo:self]; 
} 
+0

あなたは、実際にデリゲートを設定しますか?デリゲートはどこかに強い参照を持っていますか? – Eiko

+0

はい私はすでにdelegeteを設定しています。ここではメソッドを宣言しています。 – iketan

+0

別のViewControllerで 'target.delegate = self'(target = EEInterstitialScreenインスタンス)を設定しましたか?これを忘れるcozを発行するためにusplually running – Tj3n

答えて

1
AnotherViewController * obj = [AnotherViewController alloc]init]; 
obj.delegate =self; 

[self.navigationController pushViewController:obj]; 
関連する問題