title: Programmatically set rootViewcontroller for UINavigationcontroller in Storyboard in Appdelegate
body: <p>I have a value in <code>NSUserdefaults</code>. I am using <code>storyboard</code>, it is embedded in <code>UINavigationController</code>.</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
       if([[NSUserDefaults standardUserDefaults]objectForKey:@"isLoggedIn"]){
           //show home page here
          }else{
             // show login view
          }
  }
  </code></pre>
  
  <p>I can open the app using a <code>URL</code> also</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
           NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  
           if(text.length &gt; 0){
             // show home page 
  
           }else {
            // show settings page
          }
  
          return YES;
  }
  </code></pre>
  
  <p>How can I set the <code>rootViewController</code> for the <code>UINavigationController</code> based on the value that is retrieved .Can anyone please help me out?</p>