问题描述
我目前正在开发一个以模态形式显示屏幕和以模态形式显示另一个自定义进度指示器的应用程序.是否可以无缝返回到根View Controller?
I am currently working on an app which presents a screen modally and another custom progress indicator modally. Is it possible to return to the root View Controller seamlessly?
主页->屏幕1->屏幕2(自定义进度指示器)
Home -> screen1-> screen2(Custom progressIndicator)
我想关闭自定义的progressIndicator(以及模态显示的屏幕),然后一次性返回到我的家(根)View Controller.
I want to dismiss the custom progressIndicator (and the screen presented modally) and return to my home (root) View Controller in one go.
self.navigationController?.popToRootViewControllerAnimated(true)
谢谢您的帮助!
推荐答案
您需要关闭显示的模型,然后才能弹出所有推入的视图控制器.如前所述,模型不会出现在导航堆栈中.
You need to dismiss presented model then you can pop all the pushed view controllers. As presented model would not be in the stack of the navigation.
self.dismissViewControllerAnimated(true, completion: {});
然后您可以弹出至基本视图控制器.
Then you can pop to base view controller.
self.navigationController.popViewControllerAnimated(true);
这篇关于如何返回到根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!