gpt4 book ai didi

iphone - [self.navigationController popViewControllerAnimated :YES];? 之后调用什么方法

转载 作者:行者123 更新时间:2023-12-03 20:21:04 25 4
gpt4 key购买 nike

我有这个代码:

-(IBAction)OkButtonPressed:(id)sender{
NSLog(@"BTN OK");
RecherchePartenaireTableView *recherchePartenaireTableView=[[RecherchePartenaireTableView alloc]init];
recherchePartenaireTableView.mytext=textFieldCode.text;

[self.navigationController popViewControllerAnimated:YES];
}

按“确定”后,我在控制台中看到消息“BTN OK”,没有其他内容。在 RecherchePartenaireTableView 类中,我有方法 viewWillAppear、viewDidload... 以及每个方法的 NSLog 消息。 [self.navigationController popViewControllerAnimated:YES]; 之后调用了什么方法?

最佳答案

如果您尝试设置类 RecherchePartenaireTableView 的属性,该类已经位于导航堆栈上,那么您创建它的新实例就错了。

您应该从 navigationController 堆栈中取回该实例。

改变

RecherchePartenaireTableView *recherchePartenaireTableView=[[RecherchePartenaireTableView alloc]init];
recherchePartenaireTableView.mytext=textFieldCode.text;

NSArray *viewControllers = [self.navigationController viewControllers];
RecherchePartenaireTableView *recherchePartenaireTableViewVC = (RecherchePartenaireTableView *)[viewControllers objectAtIndex:viewControllers.count - 2];
recherchePartenaireTableViewVC.mytext=textFieldCode.text;

viewDidAppear 方法将在您推送 View 的类上调用。

关于iphone - [self.navigationController popViewControllerAnimated :YES];? 之后调用什么方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7498687/

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