Auto-rotate the default application image according to current landscape mode

心已入冬 提交于 2019-12-23 05:47:10

问题


Is it possible to auto-rotate the default application image according to current landscape mode? I can rotate my views just fine according to information from the UIDevice class, but I would like the whole application to be in the correct landscape mode from the start.


回答1:


This isn't possible at the moment. If your app is designed to be in landscape mode you can obviously rotate your Default image but there is no way to show a different image or rotate it based on the orientation when your app launches.




回答2:


Update

Updated after comments...

A trick you can use: Use a portrait default.png

On launch load the default.png in a UIImageView and perform the rotation yourself.

UIImageview *myImage = [UIImageView alloc] initWithImage:[UIImage imageNamed:@"default.png"]]];

[UIView beginAnimations:@"rotate" context:nil]
[UIView setAnimationDelay:0.25];
[UIView setAnimationDuration:duration];

//rotation transform logic

[UIView commitAnimations];  

You can rotate it to where left or right according to your setup. Then fade in your UI with another animation block.


Original answer

This kind of doesn't make sense. There isn't a need to rotate the graphic.

If you launch in landscape, then simply create your launch graphic in landscape (using photoshop or something similar).

If you think sometimes the phone will be in landscape and sometimes it won't during launch, that's not really an issue. The HIGs instruct you to simply display a view in the correct orientation if it only supports that orientation. Example: The Youtube app automatically goes to landscape to show a video and back to portrait to show the table view. You shouldn't compensate for what your user may be doing prior to launch.




回答3:


This is now possible in Xcode 4.0 here is a downloadable application doing specifically doing that.



来源:https://stackoverflow.com/questions/883927/auto-rotate-the-default-application-image-according-to-current-landscape-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!