Add a new Objective-C class (subclass of UINavigationController) and add the following code to the .m files
-(NSUInteger)supportedInterfaceOrientations { NSLog(@"supportedInterfaceOrientations = %d ", [self.topViewController supportedInterfaceOrientations]); return [self.topViewController supportedInterfaceOrientations]; } -(BOOL)shouldAutorotate { return self.topViewController.shouldAutorotate; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
After adding new classes, go to ViewController classes and make the following changes
- (BOOL)shouldAutorotate // iOS 6 autorotation fix { return YES; } - (NSUInteger)supportedInterfaceOrientations // iOS 6 autorotation fix { return UIInterfaceOrientationMaskAll; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation // iOS 6 autorotation fix { return UIInterfaceOrientationPortrait; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return YES; }

In shouldAutorotate, shouldAutorotateToInterfaceOrientation: return YES if you want the ViewController to support the multiple orientation else return NO, also in the houldAutorotateToInterfaceOrientation: the method passes the Orintation you want for this particular ViewController, repeat the same for all view controllers.
The reason of that: -
1: Although you can change the preferred InterfaceOrientationForPresentation: of any viewController to a specific orientation, but since you are using the UINavigationController, you also need to override the supported interfaces for your UINavigationController
2: To override the supported interfaces for the UINavigationController, we subclassed the UINavigationController and modified the method associated with the UINavigation orientation.
Hope this helps you!
source share