简体   繁体   English

iPhone应用程序在横向打开

[英]iPhone App opens in Landscape

My universal app (targeting 4.3) opens in landscape and then rotates to portrait, if user is holding device in portrait orientation. 如果用户将设备保持为纵向,我的通用应用程序(定位为4.3)将以横向打开,然后旋转为纵向。 This doesn't occur on the Pad. 在Pad上不会发生这种情况。 Also I can't see anything in the plist or code that would make this happen. 另外,我在plist或代码中看不到任何会导致这种情况发生的情况。 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. 编辑:尚未找到解决方案,但问题似乎是plist中“支持的界面方向”的顺序。 This doesn't affect the Pad. 这不会影响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. 在手机上,如果plist中的第一项是横向,则无论手机的实际方向如何,应用都会以横向打开。 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. 我想知道这是否只是一个未记录的功能。

try this 尝试这个

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM