我有一个导航 Controller ,它提供了一个模态viewController。从这个模态viewController内部,我展示了另一个模态viewController。我想要的只是从最后一个模态viewController返回到navigationController(根viewController)。与popToRootViewController类似,但适用于modalViewControllers。

NavigationController->当前模式ViewController A->当前模式ViewController B

我想从模式ViewCOntroller B返回到navigationCOntroller。

这可能吗?

欣赏,
亚历克斯

最佳答案

在iOS 5中,您需要执行
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES]
编辑:从iOS 6开始不推荐使用dismissModalViewControllerAnimated:

你需要打电话
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{ // Do something on completion}]

10-08 03:40