gpt4 book ai didi

ios - popViewController :animated: not working in iOS 9

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:06:18 25 4
gpt4 key购买 nike

我正在使用子类化的 UINavigationController,它管理我的应用程序中的所有 viewController。它在主流程中推送和弹出 viewControllers,并以模态方式呈现和关闭那些任意需要的 viewControllers。

在一种情况下,我需要在主流程中弹出另一个 View Controller 之前以模态方式呈现一个 View Controller ,如下所示:

//Called in custom UINavigationController subclass
[self presentViewController:searchVC animated:YES completion:^{
[self popViewControllerAnimated:NO];
}];

上面的代码在 iOS 8 之前可以正常工作,在 iOS 9 中不工作。当呈现的 vc 被关闭时,与以前相同的 viewController 仍然存在。

此外,这正在控制台中记录:

popViewControllerAnimated: called on <CustomNavigationController 0x7d846600> while an existing transition or presentation is occurring; the navigation stack will not be updated.

直到现在这都不是问题,特别是因为在完成 block 中调用了 popViewController 方法。

这会是一个错误吗?

欢迎任何解决方案/建议/解决方法。

最佳答案

将 popViewController 调用包装在 dispatch_async block 中有效。

[self presentViewController:searchVC animated:YES completion:^{
dispatch_async(dispatch_get_main_queue(), ^{
[self popViewControllerAnimated:YES];
});
}];

关于ios - popViewController :animated: not working in iOS 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32665658/

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