Some changes have been made to the automatic screen rotation in iOS 6 SDK. For example, for Master-Detail apps, the master viewcontroller does not support screen rotation, and the detail viewcontroller supports screen rotation.
Enable automatic rotation in info. plist or target-Summary, and select the required supported interface orientations. Create uinavigationcontroller + autorotation. H category and disable automatic rotation of the bottom navcontroller as needed:
1234 |
- (BOOL)shouldAutorotate{ return NO;}
|
Set in appdelegatewindow.rootViewController
= navController;, BecauseshouldAutorotateToInterfaceOrientation:Slave
Deprecated from iOS 6 and switchsupportedInterfaceOrientations+preferredInterfaceOrientationForPresentation.
1234567891011121314 |
- (BOOL)shouldAutorotate{ return YES;}- (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAllButUpsideDown;}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return UIInterfaceOrientationLandscapeRight;}
|
Notes:
- Rootviewcontroller needs to be set for window,
[window
addSubview:navController.view];Invalid;
shouldAutorotateValid only at the underlying level;
presentModalViewControllerThe previous automatic rotation control is invalid.
CATEGORY solution.
Http://fann.im/blog/2012/10/22/autorotation-changes-in-ios-6/