在我们的故事板中,我们有多个UINavigationController
堆栈。例如,LoginViewController
堆栈与堆栈完全分离SWRevealViewController
。
在它们之间切换的最佳做法是什么?当我按下注销按钮(注销按钮在SWRevealController
堆栈上)然后尝试显示 LoginViewController 堆栈时,我收到如下错误:
Warning: Attempt to present LoginViewController on SWRevealViewController whose view is not in the window hierarchy!
即使我在 App Delegate 中专门设置self.window.rootViewController
了登录视图控制器,如下所示:UINavigationController
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Spitfire" bundle:nil];
UINavigationController *nav = [storyboard instantiateViewControllerWithIdentifier:@"LoginNavigationController"];
LoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
self.window.rootViewController = nav;
[nav presentViewController:loginVC animated:NO completion:nil];
有没有办法可以“关闭”当前UINavigationController
堆栈并使用新堆栈?或者也许我不应该在我的应用程序委托中调用此代码?