In our storyboard we have multiple UINavigationController
stacks. For example, the LoginViewController
stack is completely separate from the SWRevealViewController
stack.
What's the best practice for switching between them? When I press the logout button (the logout button is on the SWRevealController
stack) and then try to present the LoginViewController stack, I get an error like this:
Warning: Attempt to present LoginViewController on SWRevealViewController whose view is not in the window hierarchy!
Even though I'm specifically setting self.window.rootViewController
to the Login View Controller's UINavigationController
in App Delegate like this:
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];
Is there a way I can "dismiss" the current UINavigationController
stack and use a new one? Or maybe I shouldn't be calling this code in my app delegate?