---
title: "cocos2d在xcode4.5ios6上屏幕转向的问题"
author: "wjjxf"
date: "2012-12-15T19:20:10Z"
tags: ["Objective-C", "appstore", "iOS"]
categories: ["移动开发"]
slug: "cocos2d-xcode4-5ios6"
draft: false
lastmod: "2012-12-15T19:20:10Z"
id: 1748469
url: "https://hfutfei.iteye.com/blog/1748469"
---

在ios5.1.1真机上测试的非常好，然后上传到appstore，等1周的结果是被拒，苹果审核人员到是仔细，给了我他们的屏幕截图和操作系统环境，在ios6.0.1下屏幕会错位，为了验证该情况，我将iPad有5.1.1系统升级到6.0.1，一看，果然如此，然后在网上找原因，终于找到解决办法：

写道

将AppDelegate.m中的\[window addSubview:viewController.view]替换为：

if (\[\[\[UIDevice currentDevice] systemVersion] floatValue] &gt;= 6.0){  
\[window setRootViewController:viewController];  
}  
else{  
\[window addSubview:viewController.view];  
}

在RootViewController.m中加入以下代码  
\-(NSUInteger)supportedInterfaceOrientations{  
return UIInterfaceOrientationMaskLandscape;  
}

\- (BOOL)shouldAutorotate {  
return YES;  
}

 估计是ios6，api有稍许改变造成的，不过问题总算是解决了