在我的应用程序中我正在做的是:
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/