How can I disable the system rotation in iOS 9?

I develop in augmented reality application that needs to disable the automatic rotation animation done by the system. However, after enabling support for iOS 9 split screen multitasking (UIRequiresFullScreen is false in Info.plist), the rotation animation happens no matter what I do. In the past, I was able to return NO from the shouldAutorotate method of my view controller.


At this point, I have to choose: disable multitasking support, or provide a compromised experience. Is this a beta 1 bug or intended behavior? Or am I just missing some workaround?


Chris

Answered by Frameworks Engineer in 13433022

When you support multitasking, you are explicitely giving up control of what orientations you support – you must support all orientations and sizes.


Doesn't it work to just add a counter rotation to your camera view?

Can you show all the orientation params in info.plist, in order?

Accepted Answer

When you support multitasking, you are explicitely giving up control of what orientations you support – you must support all orientations and sizes.


Doesn't it work to just add a counter rotation to your camera view?

I've tried adding a counter rotation, but have never been able to exactly match the transformation and timing of the automatically applied system rotation. As far as I know, this isn't possible.


To get a better idea of what I'm trying to do, consider the standard iOS camera app running on iPad. When the device is rotated, the camera view obviously rotates 90 degrees. In my app, I want the orientation of the camera view to stay completely static, either by using a non-rotating view or by exactly matching the automatic rotation. Device rotation must be imperceptible in the camera view in order to make it feel like the iPad is an augmented window to the world.


If there's no way to disable the automatic rotation itself, perhaps there's some means of at least disabling the animation?


—Chris

After some more investigation, I was able to undo the automatic rotation in the animation. Rincewind, thank you for pointing me in the right direction.


—Chris

The built in camera application uses the rotation from the transitionCoordinator to do the counter rotation – I assume you are doing the same. Along with animating in the along side, I would expect that is what you got working. Feel free to come back with any additional questions you may have! 🙂

Do you have any example code for how you were able to cancel the rotation? Would be much appreciated. Thanks.


-Greg

Hi Rincewind,


Do you have any sample code or a further explanation on how you can counter the auto rotation? I have a paticular part of my app where I want to disable rotation, but I still want to support multitasking. Any pointers you can provide would be helpful. Thanks.


-Greg

Two questions:


1. When the camera app rotates, the screen seems to stay locked where it is. When I unrotate my view controller view (using sample code from WWDC 2014 session 214), you can see the black outline of the window as the view unrotates. Why?


2. Is there a way to allow the view to stay interactive during the transition?

Could you share with us how you were able to disable the automatic rotation?

This is still a major issue for my app. Since the launch of the app (iOS 6), I've selectively disabled rotation on one view controller which takes touch input while the user tilts the device gyroscope.


To answer your question ("Doesn't it work to just add a counter rotation to your camera view?"): no. As far as I can tell, touch input is disabled during rotation. Even if the screen visually cancels the rotation, the app becomes unresponsive while the 'invisible' unrotation occurs.

You should probably just require fullscreen for now and Report a Bug requesting formal support for something like this.

How can I disable the system rotation in iOS 9?
 
 
Q