简体   繁体   English

如何关闭以模态显示的UINavigationController?

[英]How can I dismiss a UINavigationController presented modally?

I have the following structure: 我有以下结构:

UINavigationController(1) -> MainViewController     ---PRESENT MODAL---> 
UINavigationController(2) -> TutorialViewController ---PRESENT MODAL---> LoginViewController
                                                    ---PRESENT MODAL---> SignupViewController

I want to dismiss the UINavigationController(2) from a user action on LoginViewController. 我想从LoginViewController上的用户操作中撤消UINavigationController(2)。

Any idea? 任何想法?

You should use delegation to dismiss the second view controller. 您应该使用委派来关闭第二个视图控制器。 So you would have the second nav controller be dismissed by the first nav controller, the one that presented it. 因此,您将让第二个导航控制器被显示该导航器的第一个导航控制器解雇。 This is the recommended way to dismiss modal views. 这是消除模态视图的推荐方法。

Here are the docs on delegation 这是关于授权的文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS:如何让ViewController A模态地呈现B,然后直接将B取消/转换为模态呈现的C? - iOS: How can I have ViewController A present B modally and then have B dismiss/transition directly to a modally presented C? 我该如何关闭第二个已在第一个vc上模态显示的第一个vc - how can I dismiss first vc that second has presented modally on the first vc 半透明的UINavigationController,以模态显示 - Translucent UINavigationController, presented modally 如何在模态呈现的 UITableView 上关闭 UITextView 上的键盘 - How to dismiss the keyboard on a UITextView on a modally presented UITableView 我如何将数据传递给以模态形式呈现的子UINavigationController(即,通过initWithRootViewController) - how do I pass data to a child UINavigationController which is presented modally (i.e. via initWithRootViewController) 如何正确解雇一个呈现为模态的UINavigationController? - How to correctly dismiss a UINavigationController that's presented as a modal? 我解散模态显示的viewController时,我的GameScene冻结 - My GameScene Freezes when i dismiss modally presented viewController 如何在以模态显示的视图控制器上执行当前模态搜索? - How can I perform a present modally segue on a view controller that is presented modally? 如何获取UINavigationController.pushViewController来推送显示的viewController - How can I get UINavigationController.pushViewController to push on a presented viewController Swift:无法取消模态显示的LoginViewController - Swift: Not able to dismiss modally presented LoginViewController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM