Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to lock orientation on iPad Air 2

The iOS application I am working on has a view that needs to be locked in landscape orientation. Up to this point, that was accomplished by using the shouldAutorotate and supportedInterfaceOrientations methods, but on an iPad Air 2 running iOS9 beta5, these methods never fire and the orientation is not locked.

I have tried on the following devices, methods fired on all except the Air2 (running debug with Xcode beta6): iPhone 6+, iPad Mini, iPad Air 2, iPad 2, iPad 3

The methods not firing are as follows:

- (BOOL)shouldAutorotate {
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationMaskLandscapeRight;
}

View controller is displayed via presentViewController

like image 565
ackerman91 Avatar asked Sep 02 '15 17:09

ackerman91


People also ask

Can you lock rotation iPad Air 2?

Make sure Rotation Lock is turned off: swipe down from the top right-hand corner of your screen to open Control Centre. Then tap the Rotation Lock button to make sure it's turned off.

How do I stop my iPad from changing orientation?

If you have an iPhone or iPad with Face ID, swipe down from the top-left corner of the screen. If your iPhone or iPad has a Home button, swipe up from the bottom of the screen. Tap the Rotation Lock button to activate the lock. When active, the Screen Rotation lock icon will be red on a white background.


2 Answers

Multitasking can be turned off by adding the UIRequiresFullScreen field to the application's info.plist with the boolean value YES, and this will allow the orientation delegate methods shouldAutorotate, preferredInterfaceOrientation, and supportedInterfaceOrientations to fire.

As far as locking orientation AND supporting multitasking, I have not found a way to do this.

like image 122
ackerman91 Avatar answered Sep 17 '22 17:09

ackerman91


The 'Requires full screen' setting can be enabled from 'General' of the target settings.

Requires full screen

With this enabled, the orientation code will now run. As mentioned by ackerman91, you can also set UIRequiresFullScreen boolean to YES in the application info.plist or in the target 'Info' tab.

like image 21
mylogon Avatar answered Sep 17 '22 17:09

mylogon