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