Q:

Changing rootviewcontroller for navigation controller dynamically

I'm trying to change RootViewController for NavigationController in didFinishLaunchingWithOptions.
But I don't know how can I do that.
I have gone through this link as well:
http://starterstep.wordpress.com/2009/03/05/changing-a-uinavigationcontroller%E2%80%99s-root-view-controller/
Here is my code in didFinishLaunchingWithOptions:
- (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;
}

Right now I comment and then run application to change rootviewcontroller. However this is not the practical approach.
Any help will be appreciated.

A:

Instead of this:
[self.window addSubview:navigationController.view];

Put this:
self.window.rootViewController = navigationController;

