I know this subject gets a lot of attention here at SO, but none of the "solutions" is working for me. Here's the situation:
iPad is flat on my desk (a face up device orientation), the home screen is perfectly readable, but the home button is on top. So this is effectively shows a "Portrait Up Side Down" interface orientation.
I start my app
The app calls
beginGeneratingDeviceOrientationNotifications
to make sure the accelerometer is working, and the orientation notifications come in.At startup, my app queries both the "interface orientation" and the "device orientation". The results are:
STARTUP ORIENTATION: INTERFACE ORIENTATION: UIInterfaceOrientationPortrait DEVICE ORIENTATION: UIDeviceOrientationFaceUp
The Apple docs say that each app (interface?) starts in portrait orientation, so this could make sense. The device orientation is also correct, because this is indeed face up.
Right after launching, the first orientation notification is coming in:
NOTIFICATION 1: INTERFACE: UIInterfaceOrientationPortrait DEVICE: UIDeviceOrientationPortrait
Again, portrait for the interface, (which is contrary to what I'd expect, the home screen showed itself in up side down orientation), the device is said to be in portrait too (which isn't so, but this is apparantly a clever scheme to work out how to orient your app's contents when the device is face up or down).
As many people mention, another (just one, not two) orientation notification follows:
NOTIFICATION 2: INTERFACE: UIInterfaceOrientationPortrait DEVICE: UIDeviceOrientationFaceUp
Still portrait (and not up side down) for the interface, and back to face up for the device (which is correct).
My app adjusts itself correctly, and is shown up side down, which is totally wrong.
What can I do to know the last known orientation, the one's that's shown in the home screen and other UI on the iPad?
This is an OpenGL app with just a window and a view. I've already added a UIViewController to the mix to see if this gives more accurate information, but it's just the same, and wrong. I know I'm not the only dev struggling with this, because many apps I have on my iPad do it wrong too, you have to tilt the device to make them orient themselves properly. But some apps do seem to get it right, what's the secret?