gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 01:06:47 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com