So there have been lots of problems regarding orientations and iOS 6. I thought I had overcome them all, but alas have fallen at the last hurdle. My game is landscape only and rotates and works fine with Game Center.
The only issue is that if you open Game Center achievements on iOS 6, rotate the device to portrait, and then close Game Center, it leaves the game in portrait. If you then rotate it fixes itself, but this is still a major problem.
So far I have added Portrait in my Info.plist, added for iOS 6 the method
- (NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
and changed the App Delegate:
//[window addSubview: viewController.view]; <--- removed
window.rootViewController = viewController; // replacement line
To present the achievements I have in my menu scene:
presentingViewController = [[UIViewController alloc] init];
[[[[CCDirector sharedDirector] openGLView] window] addSubview:presentingViewController.view];
[presentingViewController presentModalViewController: achievements animated: YES];
And then have:
-(void) achievementViewControllerDidFinish:(GKAchievementViewController *)viewController {
[presentingViewController dismissModalViewControllerAnimated:YES];
[presentingViewController.view.superview removeFromSuperview];
}
I tried using setDeviceOrientation in the above method, which worked, but then the orientations rotated by 90 degrees (so rotating to landscape put it in portrait)... Any help would be appreciated!