title: UINavigationController flow for login ios
body: <p><strong>Solved:</strong></p>
  
  <p>once the user has logged in / signed up, use the following code to transition to the main storyboard...</p>
  
  <pre><code> UIWindow* window = [[UIApplication sharedApplication] keyWindow];
  
   window.rootViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateInitialViewController];
  </code></pre>
  
  <p>I have the following UINavigationController flow to handle logging in...the top segue after the tabbarcontroller goes to a uinavigationcontroller that is the root for a viewcontroller.</p>
  
  <p><img src="https://i.stack.imgur.com/aOBVL.png" alt="enter image description here"></p>
  
  <p>When the user is already logged in the "this segue works" is executed so that the user doesn't have to log in at the login screen. That works perfectly. The issue I run into is when the user has to login...the segue from the login/signup screen to the login screen works perfectly, but when I go from the login screen to the tabbar the following happens:</p>
  
  <p><img src="https://i.stack.imgur.com/XZXp5.png" alt="enter image description here"></p>
  
  <p>This really shouldn't happen because I have the following code in my viewcontroller.m (gotten to here is called)</p>
  
  <pre><code>- (void)viewDidLoad {
      ...
      self.navigationItem.title = @"Messages";
      self.navigationItem.hidesBackButton = YES;
  
      NSLog(@"gotten to here");
      ...
  }
  </code></pre>
  
  <p>Does anybody know why this is happening?</p>