iOS Upside Down Orientation

Hey Jules,

I'm trying to add upside down orientation support to my iOS app by adding the UIInterfaceOrientationPortraitUpsideDown flag to the list of UISupportedInterfaceOrientations. 

The Introjucer currently doesn't add this flag to projects by default. I tried adding it as a Custom PList, which works but the Introjucer just goes ahead and adds the default UISupportedInterfaceOrientations a second time which overrides the custom flags in Xcode :( 

Changing line 652 of jucer_ProjectExport_XCode.h of the Introducer from this:

if (iOS)

to this:

if (iOS && ! dict->getAllSubText().contains ("UISupportedInterfaceOrientations")) 

Worked as a quick fix, but maybe you have a neater alternative or suggestion? Maybe adding UIInterfaceOrientationPortraitUpsideDown to the defaults might be an option? 



Hi teamaxe,

We have a function in JUCE to programmatically tell iOS which orientation your app supports (see setOrientationsEnabled). Internal testing revealed that to support a particular orientation, the orientation must both be enabled in the plist and via setOperationsEnabled. Therefore, our approach is to always overwrite the plist in the Xcode project with all possible orientations and then let the user limit the orientations - if necessary - via the setOrientationsEnabled method.  Clearly, we have forgotten to add the upside down orientation to the plist, but before I add this, do you think this would be a good approach?


Hi Fabian, that seems to make sense. I'm having to update Xcode to test this but will get back to you soon.

Hi Fabian,

Thanks for looking at this. That would solve the problem for me.

One thing to note - I noticed that UIInterfaceOrientationPortrait had to appear before UIInterfaceOrientationPortraitUpsideDown 

The app launched upside down when UIInterfaceOrientationPortraitUpsideDown was first in the plist.


OK, I've added the orientation to the Xcode exporter on the latest tip. Thank you!

Hi Fabian, yes I can confirm adding "UIInterfaceOrientationPortraitUpsideDown" after "UIInterfaceOrientationPortrait" in the writeInfoPlistFile method works.

For others reading this, you'll need to remove any custom Plist entries for UISupportedInterfaceOrientations or UIViewControllerBasedStatusBarAppearance (these are now both written by the Introjucer) or you'll get problems with a the UI being positioned correctly or starting upside down.

Hi dave96, this is what I was trying to avoid. I was under the impression that you can keep all the plist entries but need to programmatically call setOperationsEnabled to limit the orientations. If this is not the case then the Introjucer shouldn't be overriding the plists, right?

I think you misunderstood my post, yes you are correct. All the orientation entries should be added to the plist by the Introjucer. Then in your app you can programmatically enable the ones you need.

If you also add custom plist entries for orientations these will appear as duplicates (next to the Introjcuer generated ones) and cause problems.


With your change everything is working as expected (now I've removed all my custom plist).

Hope that makes sense ;)

Ahh. OK thanks for clarifying. Makes perfect sense now :-)