gpt4 book ai didi

iphone - 解除模态视图 Controller 的奇怪警告

转载 作者:IT王子 更新时间:2023-10-29 08:08:10 24 4
gpt4 key购买 nike

我正在使用 iOS 6。我的应用程序有一个带有嵌入式 CustomViewController 的标准导航 Controller 。在这个 Controller 中,我创建了一个模态视图,如下所示:

-(IBAction)presentModalList:(id)sender {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
StationsListViewController *list = [storyboard instantiateViewControllerWithIdentifier:@"StationsListViewController"];
[list setStationsData: [self.stationsData allValues]];
[self presentModalViewController:list animated:YES];
}

模态 Controller 显示完美,但关闭会产生警告。这个 Controller 中的 dismiss 方法是:

-(IBAction)backToMap
{
[self dismissModalViewControllerAnimated:YES];
}

生成的警告是警告:

尝试从 View Controller 中解散,而演示或解散正在进行中!

有什么线索吗?

谢谢

最佳答案

我意识到这是一个迟到的答案,但也许这会帮助其他人寻找解决方案,这就是我所做的:

-(IBAction)backToMap
{
if (![[self modalViewController] isBeingDismissed])
[self dismissModalViewControllerAnimated:YES];
}

对我来说,我发现该行代码被多次调用,我找不到原因,所以这是最简单的修复。

关于iphone - 解除模态视图 Controller 的奇怪警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12261008/

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