xcode 如何“重新启动”应用程序 ios
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10067113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to "restart" application ios
提问by Szwedo
So I have an app where a user goes through 3 view controllers and then submits a picture to Facebook. After they submit it to Facebook, I want them to be able to choose to restart the process over again, as if they had re-launched the app.
所以我有一个应用程序,用户通过 3 个视图控制器然后将图片提交到 Facebook。在他们将其提交给 Facebook 后,我希望他们能够选择重新启动该过程,就好像他们重新启动了该应用程序一样。
How could I do this?
我怎么能这样做?
thanks
谢谢
回答by CodaFi
OK, because you haven't been clear about your navigation patterns, I'll show the two kinds of transitions and their opposites:
好的,因为你还没有清楚你的导航模式,我将展示两种过渡及其对立:
Push-Pop: Is created by pushing a new UIViewController onto the navigation stack using
Push-Pop:通过使用将新的 UIViewController 推送到导航堆栈上来创建
[self.navigationController pushViewController:exampleController animated:YES];
It is counteracted by
它被抵消
[self popToRootViewControllerAnimated:YES];
Modal View: Is created by presenting a new UIViewController over the current one.
模态视图:通过在当前视图上呈现一个新的 UIViewController 来创建。
[self presentModalViewController:exampleController animated:YES];
It is not on the navigation stack, so the possibility of presenting another modal view within the first modal view is not available. It is counteracted by calling
它不在导航堆栈中,因此无法在第一个模态视图中呈现另一个模态视图。它通过调用来抵消
[self dismissModalViewControllerAnimated:YES];
from within the modal view itself.
从模态视图本身。