iPhone 应用程序以横向方式打开

发布于 2025-01-04 09:38:18 字数 330 浏览 2 评论 0原文

如果用户以纵向握住设备,我的通用应用程序(针对 4.3)以横向打开,然后旋转到纵向。在 Pad 上不会出现这种情况。另外,我在 plist 或代码中看不到任何可以实现这种情况的内容。有其他人经历过这个并找到解决方案吗?

编辑:尚未找到解决方案,但问题似乎是 plist 中“支持的界面方向”的顺序。这不会影响 Pad。

在手机上,如果 plist 中的第一项是横向的,则无论手机的实际方向如何,应用程序都将以横向打开。加载后,如果手机处于纵向,应用程序将旋转为纵向。反之亦然,如果第一个项目是纵向,则应用程序将以纵向打开。如果手机方向为横向,则加载时它将旋转。

我想知道这是否只是一个未记录的功能。

My universal app (targeting 4.3) opens in landscape and then rotates to portrait, if user is holding device in portrait orientation. This doesn't occur on the Pad. Also I can't see anything in the plist or code that would make this happen. Has anyone else experienced this and found a solution.

EDIT: Haven't found a solution but the issue appears to be the order of the "Supported interface orientations" in the plist. This doesn't affect the Pad.

On the phone, if the first item in the plist is landscape, then the app will open in landscape regardless of the phone's actual orientation. Once loaded, if the phone is in portrait, the app will rotate to portrait. And vice versa, if the first item is portrait, then the app will open in portrait. If phone orientation is landscape it will rotate when loaded.

I'm wondering if this is just an undocumented feature.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼趣 2025-01-11 09:38:18

试试这个

if([[UIDevice currentDevice] orientation]==1)
{
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
}
else
{
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
}

try this

if([[UIDevice currentDevice] orientation]==1)
{
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
}
else
{
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文