How to add navigation controller in xcode?


In the appDelegate.m add the following code :

– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.

// Declare the view controller in appDelegate.h 
    self.viewController = [[[ViewController alloc] initWithNibName:@”ViewController” bundle:nil] autorelease];
        
       UINavigationController * navigationController = [[UINavigationController alloc]
                            
                            initWithRootViewController:self.viewController];

    
   
    self.window.rootViewController = navigationController;    
    [self.window makeKeyAndVisible];
    return YES;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s