【发布时间】:2016-01-26 22:24:00
【问题描述】:
我正在做一个具有多个独立 ViewControllers 的 Objective-C 应用程序。 当用户按下主页按钮并且应用程序进入后台模式时,我想显示我的主 ViewController。 我发现的所有解决方案都适用于导航控制器。 在这种情况下,我如何启动(以及在哪里) ViewController?
谢谢
已解决: 最后我在 AppDelegate 中添加解决了这个问题:
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
ViewController *viewController=[[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"ViewController"];
self.window.rootViewController = viewController;
}
【问题讨论】:
标签: ios objective-c