关闭两个模态视图控制器
我有一个导航控制器,它呈现一个模式视图控制器。在这个模态视图控制器内部,我展示了另一个模态视图控制器。我想要的只是从最后一个模态视图控制器返回到导航控制器(根视图控制器)。与 popToRootViewController 类似,但适用于 modalViewController;
导航控制器 ->当前模态视图控制器 A ->当前模态视图控制器 B
从模态 ViewCOntroller BI 想要返回到 navigationCOntroller。
这可能吗?
欣赏, 亚历克斯.
I have a navigation controller which present one modal viewController. From inside this modal viewController I present another modal viewController. All I want is to get back from the last modal viewController to the navigationController (the root viewController).Something similar with popToRootViewController, but adapted for modalViewControllers;
NavigationController -> present Modal ViewController A -> present Modal ViewController B
From modal ViewCOntroller B I want to return to navigationCOntroller.
Is this possible?
Appreciate,
Alex.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 iOS 5 中,您需要执行
[self.presentingViewController.presentingViewController DismissModalViewControllerAnimated:YES]
编辑:从 iOS 6 开始
dismissModalViewControllerAnimated:
已弃用。您需要调用
[self.presentingViewController.presentingViewController DismissViewControllerAnimated:YES Completion:^{ // 完成时执行某些操作}]
In iOS 5 you need to do
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES]
Edit: As of iOS 6
dismissModalViewControllerAnimated:
is deprecated.You need to call
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{ // Do something on completion}]
问题解决了:)
我尝试过
并且有效。
谢谢。
Problem solved :)
I tried
and works.
Thanks.