Reputation: 21
I have an app with 4 viewcontrollers. One must be presented only in landscape mode. The other 3 can be either landscape or portrait.
In my Deployment Information area, Device Orientation, I have Upside Down, Landscape Left, and Landscape Right checked. In Info.plist I have 3 supported Interface Orientations: Landscape Left, Landscape Right, and Portrait Top Home Button.
In my view controller where I want ONLY landscape I have: -(BOOL) shouldAutorotate{ return YES; }
-(UIInterfaceOrientationMask) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeLeft+UIInterfaceOrientationMaskLandscapeRight;
}
In the other 3 view controllers I have: -(BOOL) shouldAutorotate{ return YES; }
-(UIInterfaceOrientationMask) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
With all of these settings: 1) The view that should only be in landscape is only in landscape, so that's good. 2) The other 3 views can be shown in landscape left, landscape right and portrait mode with the button at the top. 3) When I try to rotate the screen in the other portrait position it doesn't rotate.
So, I change the Deployment page or the Info.plist page to include that 4th choice that isn't checked. The result is that the 3 other views rotate ok, but the landscape mode view now rotates into portrait.
What do I have to do to get my first view landscape only and the other 3 to rotate any way?
Upvotes: 2
Views: 2200
Reputation: 831
You can use this link to control your orientation, this worked for me.
https://stackoverflow.com/a/24928474/6438500
Upvotes: 0