gpt4 book ai didi

ios - 警告 : Attempt to dismiss from view controller while a presentation or dismiss is in progress

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

在我的应用程序中我正在做的是:

rootViewController -> pushViewController -> pushViewController -> pushViewController -> presentModalViewController

我想从 presentModalViewController 直接转到 rootViewController。

所以我所做的是:

while(theViewController = [theObjectEnumerator nextObject ])
{
if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
{
[self.mNavigationController popToRootViewControllerAnimated:
YES];
}
}
}else
while(theViewController = [theObjectEnumerator nextObject ])
{
if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
{
[self.mNavigationController dismissModalViewControllerAnimated:YES];
}
}

但是我收到一条消息
警告:在演示或解散过程中尝试从 View Controller 中解散!

在这个应用程序崩溃之后。

我搜索了这个但找不到对我有用的东西,谁能解释为什么会这样?

最佳答案

[self dismissViewControllerAnimated:YES completion:^{
[(UINavigationController *)self.presentingViewController popToRootViewControllerAnimated:YES];
}];

这段代码对我来说很好,

重要:

viewController 必须由 navigationController 呈现。 (大多数情况下)如果没有,调用 self.presentingViewController.navigationController

关于ios - 警告 : Attempt to dismiss from view controller <UINavigationController: 0xb359a20> while a presentation or dismiss is in progress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18934342/

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