0
votes

i have a tabbar application and as you may know, you have to return YES in the shouldAutorotate method in every view controller for the views to be able to rotate. My problem is that i want to prevent a view from rotating and if i return NO then the other views won't rotate either. Is there a work around for this? Info: i'm not subclassing UITabbarController in any of my views.

Thanks in advance.

2

2 Answers

0
votes

In theory you could check in shouldAutorotate what the current view is:

if ( currentView == viewThatShouldNotRotate )
    return NO;

However, shouldAutorotate is only called when changing the view controller. If you want only one view to autorotate, consider giving it its own view controller that the UITabBarController can present as a modal view. You'll have to handle the navigation logic yourself though.

0
votes

Use the ShouldAutoRotateToInterFaceOrientation: method

 [self.navigationController 
 shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];