返回“主”应用程序关闭(然后启动)时查看控制器
我有一个带有 2 个视图控制器的项目,基本上是天气应用程序或股票。应用程序使用故事板并通过 segues 在视图之间切换。 第一个视图是“主”视图,第二个视图是应用内设置。
所以我进入“设置”,然后按主页按钮。
我需要下次启动应用程序时位于主视图中,而不是在设置中。应用程序进入后台后(按下主页按钮时),如何从第二个 vc 切换到第一个 vc?
我需要在某处使用“performSegueWithIdentifier:”吗?我可以从应用程序委托执行它吗?
I have a project with 2 view controllers, basically as Weather app or Stocks. App uses storyboard and switching between views with segues.
1-st view is "main", 2-nd is in-app settings.
So I go to "settings" and then press home button.
I need when I launch app next time to be in main view, not in settings. How do I switch from 2-nd vc to 1-st after app goes to background (when home button is pressed)?
Do I need to use "performSegueWithIdentifier:" somewhere? Can I execute it from app delegate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 AppDelegate 的 applicationWillResignActive 中进行切换。这在您的应用程序变为非活动状态之前的某个时刻被调用。
Make the switch in your AppDelegate's applicationWillResignActive. This is called a moment before your app becomes inactive.