Skip to content

Instantly share code, notes, and snippets.

@charliefulton
Created February 18, 2013 01:13
Show Gist options
  • Save charliefulton/4974532 to your computer and use it in GitHub Desktop.
Save charliefulton/4974532 to your computer and use it in GitHub Desktop.
code to fix iOS6.x + orientation issues with cocos2d 1.1
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
@charliefulton
Copy link
Author

http://www.cocos2d-iphone.org/forum/topic/43835

Confirmed that it fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment