幸运快三

Cocos2d-iOS中的装备偏向

:7.1,运转于:iPhone 6s Plus

我的AppDelegate.mm有以下代码:

- (void) applicationDidFinishLaunching:(UIApplication*)application
---------some code
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
     NSLog(@"if");
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#else
          NSLog(@"else");
    [director setDeviceOrientation:kCCDeviceOrientationPortrait];
#endif
---------somecode

我的GameConfig.h有:

#define GAME_AUTOROTATION kGameAutorotationUIViewController

幸运快三我的RootViewController.m有:

if GAME_AUTOROTATION == kGameAutorotationUIViewController
    return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );

我的Xcode设置是:

虽然装备偏向转向横向,但游戏依然以纵向显示.游戏截图以下:

在RootViewController.m中添加supportedInterfaceOrientations函数

-(NSUInteger)supportedInterfaceOrientations {

    // iPhone only
    if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone )
        return UIInterfaceOrientationMaskLandscape;

    // iPad only
    return UIInterfaceOrientationMaskLandscape;
}
相关文章
相关标签/搜索