My application supports every 4 orientation, I have a UIViewController
which is in LandscapeRight
.
I am using UINavigationController
to push that UIViewController
, i want that UIViewController
to be only in UIInterfaceOrientationLandscapeRight
but when I rotate the phone, it switches back to other Orientation.
-(BOOL)shouldAutorotate{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationLandscapeRight;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeRight;
}
just remove those shouldAutorotate, supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation.
and add this to the viewcontroller you want to display landscape only.
actually, this is from a similar question with solution here. How to force view controller orientation in iOS 8?