繁体   English   中英

试图回到应用程序的第一个UIViewController

[英]Trying to Get Back to the First UIViewController of the App

我有一个应用程序,我试图从MainViewController重新加载原始viewcontroller。 没有.xib在AppDelegate中创建应用程序的第一个视图。 在我加载了一些做其他事情的UIViewControllers之后,我需要返回到应用程序在启动时启动的原始webView(ViewController)。 我真的很难在Web上研究任何工作。 我只需要一种方法来重新加载应用程序开始的原始视图。 任何人都可以为我提供任何可能的解决方案吗? 我没有选择尝试。

谢谢!

您可以再次设置rootViewController。

在app委托中使用:

self.window.rootViewController = yourFirstViewController;

祝好运!

编辑:

此外,您可以使用以下方式全局访问应用程序委托:

[[[UIApplication sharedApplication] delegate]

我发布了一个可以帮助您的小示例项目:

https://github.com/luisespinoza/ChangeViewController

祝好运!

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM