Detecting iPad launch orientation
I'm developing an app that will feature a splash screen fading to the first app page. This splash screen is supposed to seamlessly flow from the Default-X.png image from the app launch. I've got this working great, except for one very开发者_开发技巧 special situation.
If the user taps the app icon, then IMMEDIATELY changes orientation, the automatic Default-X.png will come up from the original orientation (as expected), but my programmatically-defined intro image comes up in the new orientation. (I guess this is expected, too, now that I think about it.)
My question is, how can I get the actual launch orientation. NOT the orientation available when the app delegate starts, but the orientation of the device when the app icon is tapped, and therefor the orientation the OS uses to decide on the Default-X.png image.
Thanks.
I spent hours on this, then I found this and it saved me.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
UIInterfaceOrientation orientation = [UIDevice currentDevice].orientation;
精彩评论