gpt4 book ai didi

ios - 未调用委托(delegate)方法

转载 作者:行者123 更新时间:2023-11-28 21:54:28 25 4
gpt4 key购买 nike

我不确定为什么我的委托(delegate)方法没有被调用。下面是我的代码。请告诉我哪里出错了。我已经正确地进行了所有设置,我确信我犯了一个愚蠢的错误。我的委托(delegate)方法没有被调用。任何帮助将不胜感激

LSFiveViewController.h

    @protocol OneToOne;
@protocol OneToOne <NSObject>
@optional
-(void)dismissPopOverlsfive;
@end

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "TimeTableViewController.h"


@class TimeTableViewController;

@interface LearningSessionFiveDetailsViewController : UIViewController<UITextFieldDelegate>
{
NSString *bookingString;
}

@property(nonatomic,weak)id<OneToOne>OneToOne;

@end


**LSFiveViewController.m**


@synthesize sessionAndDateLabelObj,OneToOne

- (void)viewDidLoad
{

[super viewDidLoad];

// Do any additional setup after loading the view.
}


- (IBAction)BookSingleSessionAction:(id)sender
{


if (self.OneToOne && [self.OneToOne respondsToSelector:@selector(dismissPopOverlsfive)])
{
[self.OneToOne dismissPopOverlsfive];
}

}

@end

TimeTableViewController.h

#import "OneToOneViewController.h"
#import "LearningSessionFiveDetailsViewController.h"
//other codes

@property(nonatomic,strong)LearningSessionFiveDetailsViewController *LSFiveObj;

@end

TimeTableViewController.m

#import "TimeTableViewController.h"

#import "LearningSessionFiveViewController.h"
#import "UIAlertView+Blocks.h"

- (void)viewDidLoad
{
LSFiveObj=[[LearningSessionFiveDetailsViewController alloc]init];
self.learnSearchFiveClassObj.OneToOne=self;
}

-(void)dismissPopOverlsfive
{
This method is not being called

}

最佳答案

请放这个

self.LSFiveObj.OneToOne=self;

代替

self.learnSearchFiveClassObj.OneToOne=self;

并在你的类中添加OneToOne协议(protocol)

关于ios - 未调用委托(delegate)方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27062965/

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