title: Changing rootviewcontroller for navigation controller dynamically
body: <p>I'm trying to change <code>RootViewController</code> for <code>NavigationController</code> in <code>didFinishLaunchingWithOptions</code>.<br>
  But I don't know how can I do that.</p>
  
  <p>I have gone through this link as well:<br>
  <a href="http://starterstep.wordpress.com/2009/03/05/changing-a-uinavigationcontroller%E2%80%99s-root-view-controller/" rel="nofollow">http://starterstep.wordpress.com/2009/03/05/changing-a-uinavigationcontroller%E2%80%99s-root-view-controller/</a></p>
  
  <p>Here is my code in <code>didFinishLaunchingWithOptions</code>:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  
      UIViewController *rootController=[[HomePageController alloc] initWithNibName:@"HomePageController" bundle:nil];
      navigationController=[[UINavigationController alloc] initWithRootViewController:rootController];
  
  //    presentation=[[PresentationController alloc]initWithNibName:@"PresentationController" bundle:nil];
  //    
  //    navigationController=[[UINavigationController alloc]initWithRootViewController:presentation];
  //    
  //    presentationList=[[PresentationListController alloc]initWithNibName:@"PresentationListController" bundle:nil];
  //    
  //    UINavigationController *listnavigation = [[UINavigationController alloc] initWithRootViewController:presentationList];
  //    
  //    revealer=[[ZUUIRevealController alloc]initWithFrontViewController:navigationController rearViewController:listnavigation];
  
      [self.window addSubview:navigationController.view];
  
      [self.window makeKeyAndVisible];
      return YES;
  }
  </code></pre>
  
  <p>Right now I comment and then run application to change <code>rootviewcontroller</code>. However this is not the practical approach.</p>
  
  <p>Any help will be appreciated.</p>