My navigation stack looks like this:
[UINavigationController] ---> [ViewController1] ---> [ViewController2] ...
I want to lock ViewController1
in portrait orientation but ViewController2
can rotate freely.
I tried to put these line of codes in various places but they don't work.
-(BOOL)shouldAutorotate {
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
I also tried to sub-classing UINavigationController
as well (accepted answer in few other questions with similiar issue) but nothing works.
I'm also having a left sidebar controller using MMDrawerViewController
.
The problem is ViewController1
can still rotate to other orientations, after many attempts.
Anybody know how to fix this ? Thanks in advanced.