Like many people, I have a splash screen that animates off to reveal the first view of my app. I've been reworking this for the iPad and if you are holding the device in portrait or landscape modes, everything works as intended, the correct default image is used, the correct image that is used to animate this off is used, all orientations work fine.
BUT
If I get the device into landscape mode, and then lay it flat on the table, things go wrong. The correct splash screen is used, but the image used to animate it off is wrong and I have traced this to the following code which is returning 5 - ie none of the portraitupsidedown / portrait / landscapeleft /landscaperight modes that it is meant to return.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIInterfaceOrientation orientation = [UIDevice currentDevice].orientation;
The device itself clearly knows the correct orientation to use as the status bar is correct and indeed the first view controller rotates into the correct orientation - but what is clear is that [UIDevice currentDevice].orientation is not the same as the device actually knows and so the code I am using to deploy appropriate graphics inside the app delegate is wrong.
I guess my question is - how can I fix this? Is there a way of getting the correct device orientation within the app delegate?