I am currently developing an application that works with iOS 5 and iOS 6. Most of my views are only on Portrait orientation except for 1.
RotationNavigationController : Main UINavigationController
that overrides supportedInterfaceOrientation
and shouldAutorotate
.
PageViewController : Pushed in RotationNavigationController and is displayed in Portrait orientation only.
ImageViewController : Pushed after PageViewController. Is displayed with UIInterfaceOrientationMaskAllButUpsideDown
.
Here's what I have in the ImageViewController
's ViewDidLoad
- (void)viewDidLoad
{
// currentMask is the value returned by supportedInterfaceOrientation
[(RotationNavigationController*)self.navigationController setCurrentMask:UIInterfaceOrientationMaskAllButUpsideDown];
[(RotationNavigationController*)self.navigationController setShouldAutorotate:YES];
}
And when I popViewController
from ImageViewController in landscape, I get back to PageViewController in landscape mode too whereas PageViewController only supports Portrait orientation.
Of course, I reset the mask in the ImageViewController's viewWillDisappear
to Portrait.
Is there a way for PageViewController to remain in Portrait orientation ?