Created
February 18, 2013 01:13
-
-
Save charliefulton/4974532 to your computer and use it in GitHub Desktop.
code to fix iOS6.x + orientation issues with cocos2d 1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I made it work by playing around with the orientations and coming back to the original solution ... | |
The final solution is quite close to the one given on the other threads : | |
In the appDelegate : | |
#if GAME_AUTOROTATION == kGameAutorotationUIViewController | |
[director setDeviceOrientation:kCCDeviceOrientationPortrait]; | |
#else | |
[director setDeviceOrientation:kCCDeviceOrientationLandscapeRight]; | |
#endif | |
// make the OpenGLView a child of the view controller | |
[viewController setView:glView]; | |
// Set RootViewController to window | |
NSString *reqSysVer = @"6.0"; | |
NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; | |
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) | |
{ | |
[window setRootViewController:viewController]; | |
} else | |
{ | |
[window addSubview: viewController.view]; | |
} | |
And in the RootViewController : | |
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | |
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000 | |
-(NSUInteger)supportedInterfaceOrientations{ | |
return UIInterfaceOrientationMaskLandscape; | |
} | |
- (BOOL)shouldAutorotate { | |
return YES; | |
} | |
#endif | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.cocos2d-iphone.org/forum/topic/43835
Confirmed that it fixes the issue