Fazil
Fazil

Reputation: 1390

How to add navigation controller in landscape ios6

While am trying to add navigation controller in landscape based app ios6 application it shows in Portrait Mode only like in the image,What change should i made?enter image description here

In app delegate file coding,

 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.window addSubview:[navigationController view]];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

Upvotes: 0

Views: 192

Answers (1)

Ajay Sharma
Ajay Sharma

Reputation: 4517

Check this to add UINavigationController in your app :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // start of your application:didFinishLaunchingWithOptions
    // ...

    viewController = [[ViewController alloc]init];

    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:viewController];
    [self.window setRootViewController:navigationController];
    [window makeKeyAndVisible];

    [viewController release];
    [navigationController release];

    return YES;
}

Upvotes: 1

Related Questions