I have overridden my UINavigationController to implement these methods:
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
Now from my first view, I modally present this MSNavigationPaneViewController here which is like a Facebook side sliding tab bar controller.
I need 1 of my view controllers that are displayed within here to be displayed Landscape only while the rest of the app's views are Portrait only.
So in all my other View Controllers I have added:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
return UIInterfaceOrientationMaskPortrait;
}
and in the one that I want Landscape i've added:
- (BOOL)shouldAutorotate
{
return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
However all my views rotate.
If I change shouldRotate
to NO on these other views then they stay in Portrait and the view I want to be Landscape can be rotated, however I can't get it to rotate itself.
Also, once rotated if I go back to another view that has shouldRotate = NO;
then it can't be rotated back to Portrait.
I've been at this for hours now and can't get it to work.
Thanks
EDIT -----
I have this half working now and have started a new question to get the auto rotation working here