My app has view controllers subclassing shouldautorotateToInterfaceOrientation. And in it, I decides each view\'s rotation. This works correctly. But in iOS6, t
When you use UINavigationController or UITabbarViewController - application always does what they say in their shouldAutorotate, supportedInterfaceOrientations methods.
You can add a category for them to redirect these methods to the controller they currently display. Like this:
@implementation UINavigationController (Rotation_IOS6)
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
@end
Similar for UITabbarViewController.
The following link might steer you to the right direction: http://code.shabz.co/post/32051014482/ios-6-supportedorientations-with-uinavigationcontroller
Basically, you need to subclass UINavigationController and have it listen to changes in -supportedInterfaceOrientations
of its topViewController
. There is a sample class you can download in the blog post and also explains what code to add.
In my opinion, this is the best explaination i have found : http://www.widemann.net/wp-fr/?p=662 but it's in french.
Maybe it makes sense with google traduction in english