Set UIInterfaceOrientationPortraitUpsideDown in Projucer



Hi there!

I’m making an app that needs the ability to be turned upside down on iOS. In the Projucer app there are only 4 options:

  • Default (Portrait and Landscape)
  • Portrait and Landscape
  • Portrait
  • Landscape

I would like to propose to also implement

  • All
  • Portrait and Upside Down

I get that we’re meant to implement the call setOrientationsEnabled(int allowedOrientations) and use the enums

My problem with this solution is that I have native implementation on iOS and Android, and so I need the flags to be set correctly directly in the plist whenever I run the projucer. Setting the flags above in the Juce part of my app does not have an impact on the native part of my apps. Furthermore I need to implement ViewController specific fixes for each visible VC on iOS for it to understand that I really, really want it to be able to turn. But that is my choice when making a native implementation, so that’s fair.
But I would love if I could set the flags directly from the projucer, as they are reset each time I run it.

The changes needed would be related to a quick fix I made in juicer_ProjectExport_Xcode.h: (see portraitupsidedown)

for (int i = 0; i < (orientationsAreTheSame ? 1 : 2); ++i)
    StringArray iOSOrientations;

    if (screenOrientations[i].contains ("portrait"))   { iOSOrientations.add ("UIInterfaceOrientationPortrait"); }
    if (screenOrientations[i].contains ("portraitupsidedown")) { iOSOrientations.add ("UIInterfaceOrientationPortraitUpsideDown"); }
    if (screenOrientations[i].contains ("landscape"))  { iOSOrientations.add ("UIInterfaceOrientationLandscapeLeft"); iOSOrientations.add ("UIInterfaceOrientationLandscapeRight"); }

    addArrayToPlist (dict, String ("UISupportedInterfaceOrientations") + plistSuffix[i], iOSOrientations);

Is this something you could think about implementing?
In any case, Thanks!