`

iOS6-cocos2d游戏坐标,屏幕旋转适配

 
阅读更多

要想使cocos2d游戏在iOS6上适配,两边留黑边,只需要实现以下两步:

 

1.修改appdelegate.m中:

[window addSubview: viewController.view];

 修改为

window.rootViewController = viewController;

 2.在RootViewController.m中加入以下两个方法:

#define CC_I_O_MASK_LANDSCAPE 24  //UIInterfaceOrientationMaskLandscape
#define IOS_6_VERSION (6.0f)
- (BOOL)shouldAutorotate {
    return YES;
}
 
- (NSUInteger)supportedInterfaceOrientations {
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= IOS_6_VERSION) {
        return CC_I_O_MASK_LANDSCAPE;
    }
    return 0;
} 
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics