以横向方向启动应用程序会导致启动时的旋转 [英] Launching app in landscape orientation causes rotation on launch

查看:111
本文介绍了以横向方向启动应用程序会导致启动时的旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了shouldAutorotateToInterfaceOrientation和一切工作正常或在我的应用程序一旦运行它的方向变化。但是,我不喜欢我的应用程序的行为,当它的拳头发射。

I have implemented shouldAutorotateToInterfaceOrientation and everything works fine in terms or orientation changes in my app once it is running. However I don't like the behavior of my app when it is fist launched.

当我以纵向方向启动我的应用程序时,它按预期打开,但是当我以横向方向启动我的应用程序时,我看到一切纵向加载酒吧),然后我看到我的屏幕旋转到景观的动画。

When I launch my app in portrait orientation, it opens as expected, however when I launch my app in landscape orientation, I see everything load in portrait orientation (including the status bar), then I see an animation of my screen rotating to landscape. That animation is fine, but I don't want it to be displayed at launch.

当我查看大多数其他应用程序时,他们似乎在启动时检测方向并且它们在启动时不显示旋转动画(仅当设备在启动时间后旋转)。

When I look at most other apps, they seem to detect the orientation as they launch and they do not show the rotation animation on launch (only if the device is rotated after launch time).

如何确保我的应用程序加载到正确的方向用户在启动时看不到旋转动画。

How can I make sure my app loads in the proper orientation so the user does not see the rotation animation on launch. I would prefer it if the user only saw the rotation animation if he/she rotates the device after launching.

推荐答案

好的,我认为我想到了。对于从iPhone tempalte创建应用程序,然后为iPad修改它的任何人,您需要在-info.plist文件中添加一行支持的界面方向,并输入所有支持的方向,如下所示。

Okay I think I figured it out. For anybody who created an app from an iPhone tempalte and then modified it for iPad, you need to add a line in your -info.plist file that says "Supported interface orientations" and enter all of the supported orientations as below. Then it seems to work as expected.

    <key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

这篇关于以横向方向启动应用程序会导致启动时的旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆