cocos2d默認的是橫屏,找到ios6.0橫豎屏切換響應的函數 ios
1
2
3
4
5
6
7
8
9
10
11
12
|
// Only valid for iOS 6+. NOT VALID for iOS 4 / 5.
-(NSUInteger)supportedInterfaceOrientations {
// iPhone only
if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone )
return UIInterfaceOrientationMaskPortrait;
//return UIInterfaceOrientationMaskLandscape;
// iPad only
return UIInterfaceOrientationMaskPortrait;
//return UIInterfaceOrientationMaskLandscape;
}
|
修改後,程序卻意外的崩潰。 app
解決方案 函數
在AppDelegate.m的AppController類下添加函數: spa
1
2
3
4
5
|
//解決ios6.0橫豎屏切換程序崩潰問題
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAll;
}
|