Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lock orientation programmatically in iOS 9

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.

like image 308
hixhix Avatar asked Sep 14 '15 18:09

hixhix


1 Answers

Use supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation used to manage orientation for example

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

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}
like image 156
Oswaldo Leon Avatar answered Oct 06 '22 00:10

Oswaldo Leon