iOS6.0 xcode4.5 设置横屏

升级xcode4.5    iOS 6.0后以前的横屏项目 变为了竖屏,以下为解决办法:

在AppDelegate 的初始化方法

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

[window addSubview: viewController.view];

替换为下面代码:

    if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0){ 
        // warning: addSubView doesn't work on iOS6
        [window addSubview: viewController.view];
    }else { // use this mehod on ios6
        [window setRootViewController:viewController];
    }

在RootViewController 中添加下面两个方法 即可:

复制代码
- (NSUInteger) supportedInterfaceOrientations{

return UIInterfaceOrientationMaskLandscape;

}

- (BOOL) shouldAutorotate {

return YES;
复制代码

 

 

posted @   FoxBabe  阅读(835)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示