Cocos2d2.0横竖屏

Cocos2d-2.0横竖屏设置

<AppDelegate.m>iOS 6+设置使用

 1 // Only valid for iOS 6+. NOT VALID for iOS 4 / 5.
 2 -(NSUInteger)supportedInterfaceOrientations {
 3     
 4     // iPhone only
 5     if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone )
 6         return UIInterfaceOrientationMaskPortrait;  //竖屏设置
 7         //return UIInterfaceOrientationMaskLandscape;    //横屏设置
 8     
 9     // iPad only
10     return UIInterfaceOrientationMaskPortrait;  //竖屏设置
11     //return UIInterfaceOrientationMaskLandscape;    //横屏设置
12 }

<AppDelegate.m>iOS 4/5设置使用

 1 // Only valid on iOS 4 / 5. NOT VALID for iOS 6.
 2 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 3 {
 4     // iPhone only
 5     if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone )
 6         return UIInterfaceOrientationIsPortrait(interfaceOrientation);  //竖屏设置
 7         //return UIInterfaceOrientationIsLandscape(interfaceOrientation);   //横屏设置
 8     
 9     // iPad only
10     // iPhone only
11     //return UIInterfaceOrientationIsLandscape(interfaceOrientation);   //横屏设置
12     return UIInterfaceOrientationIsPortrait(interfaceOrientation);  //竖屏设置
13 }
原文地址:https://www.cnblogs.com/ADaii/p/2860442.html