Initial orientation on iOS is always portrait


#1

Our iOS App orientation is landscape (also set up in the plist), but JUCE initially sets up the portrait orientation and then quickly after start up changes to landscape (within the first second or so). It is quite noticeable and in earlier versions of JUCE I could fix this calling this function in our Application constructor.

From what I can tell iOS sends a callback that tells JUCE the orientation has changed after the app has started and the window is displayed. It looks like the following function is responsible for changing the orientation after the iOS callback.

However in the UIViewComponentPeer constructor the window the window’s transform is initially set to the identity.

I tried to patch it myself, but I was only able to make it switch rotations faster and not set it correctly from the beginning.

This issue can also be reproduced in the iOS Simulator.


#2

I had a quick look at this, but it does seem to be doing the right thing - it checks the orientation when the window is created, but it seems that the OS is returning portrait orientation even when it isn’t really portrait… You can see that if you trap it in the Desktop::getCurrentOrientation() call and watch what the OS returns. Not sure why that is, or what could be done about it, TBH…


#3

I had the same issue on iOS 5.1.1 (didn’t happen on iOS 6), but calling

in the app’s constructor did the trick.


#4

I have the same problem described here, but enabling the orientations, as suggested, doesn’t do the trick.
I’m building for iPad, against iOS 6.1, have set the appropriate orientation flags in the plist file, set the main window to full screen (although also tried commenting this out just in case it was the problem), and added the line suggested above to my app’s subclass constructor.
¿Any ideas of what could I be missing?
The UI always begins as if in portrait mode and once it launches it auto adjusts to landscape, but that “jump” looks horrible.
Any help would be appreciated.


#5

Wouldn’t the correct solution in this case be to force to it certain orientations? When setting your launch images for an iOS App you are already fixing your orientation. I don’t see why it should matter what orientation iOS returns if you want to force JUCE to always only use landscape.


#6

Jules, I agree with Lucasz comment in response to the window being created with the wrong orientation. If we’ve set to only use x or y orientations, even if the OS returns z, it shouldn’t draw z. Would it make sense to make that change in Juce? (i.e. to force to a “valid” orientation).
Regardless of wether that change happens or not, I’m not sure why the workaround suggested by Lucasz doesn’t work for me :-(.


#7

Not sure if it’s possible to make it use a different orientation to the one the OS is asking for, I can’t really remember how all that stuff works…


#8

I think it is possible, since all other frameworks I have used for developing iOS apps support it. I might have a look into it in the beginning of August, if no other solution is found before then.