开发者

Can you tell which image the iPad has displayed at app launch? (or, I'd like to know the orientation if possible)

There are a number of similar questions on this site about discovering the orientation of the device in applicationDidFinishLaunchingWithOptions being problematic, but I've yet to find a working solution. The problem I have is that I am adding a full screen image (identical to the currently chosen Default-XXX.png being displayed by the OS to my main window. I do this in order to have an animation happen from the 'splash screen' to my first view controller's view.

Works great, except the device keeps telling me that it is portrait mode - meaning I can't match t开发者_如何学编程he image being displayed consistently, since I have different graphics for each orientation) My understanding is that all apps default to portrait orientation until a rotation occurs inside the app (usually when presenting a viewController) but I'm not 100% convinced.


You should be able to solve this using a view controller. When the application has finished launching, present a view controller in the window. Override the shouldAutorotate… query so that the controller autorotates to portrait/landscape and when you receive one of the rotation callbacks, update the image in the view accordingly. The controller will start up in portrait, but if the device is in some other orientation, the rotation callback will immediately follow and you will get the correct image.

P.S. You might find the Orientation Zoo project helpful when debugging this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜