要想使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; }