我正在开发一个具有大约8个视图并使用导航控制器进行导航的应用程序.第一个视图是主菜单.
如果用户按下主页按钮(应用程序确实输入背景),我想要(每个视图)弹出到主视图.
我知道AppDelegate方法applicationDidEnterBackground和applicationWillEnterForeground.
我知道popToRootViewControllerAnimated从导航控制器调用的方法.
我试图在applicationDidEnterBackground中使用popToRootViewControllerAnimated.喜欢:
[self.window.rootViewController.navigationController popToRootViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
能告诉我这项工作的最佳选择吗?