5

As title, I'm wondering if it's possible to lock orientation programmatically in iOS 9 now? This is critical to my app but I can't find a way to do it. Thanks.

hixhix
  • 771
  • 7
  • 23
  • http://stackoverflow.com/questions/26357162/how-to-force-view-controller-orientation-in-ios-8 – GriffeyDog Sep 14 '15 at 18:54
  • According to http://stackoverflow.com/questions/32684922/ios9-alternative-to-uidevice-currentdevice-setvalue-to-force-orientation , it is not possible in iOS 9. – David Lara Oct 29 '15 at 17:50

1 Answers1

6

Use supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation used to manage orientation for example

-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}
Oswaldo Leon
  • 261
  • 3
  • 12