如何在横向ios6中添加导航控制器

时间:2012-12-17 11:49:40

标签: iphone uinavigationcontroller ios6

当我尝试在基于横向的应用程序ios6应用程序中添加导航控制器时,它仅在图像模式下显示,就像在图像中一样,我应该做出哪些更改?enter image description here

在app委托文件编码中,

 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];

1 个答案:

答案 0 :(得分:1)

选中此选项可在您的应用中添加UINavigationController

- (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;
}