【问题标题】:iPad device orientation // interface orientation on application startingiPad 设备方向 // 应用程序启动时的界面方向
【发布时间】:2012-06-15 16:38:44
【问题描述】:

我们有一个 iPad 应用程序。支持所有界面方向。

它工作得很好,但是在下载了 XCODE 的最后一个版本之后, - 当应用程序以 didFinishLaunchingWithOptions 启动时 - 或者执行事件applicationDidBecomeActive

虽然设备方向处于横向模式,但界面始终会变为纵向模式。

这只是第一次发生,在那之后,当我们旋转设备或模拟器时,应用程序旋转成功。

我在网上搜索,找到了下一个解决方案: - 在 app-info.plist 上手动创建 UISupportedInterfaceOrientations~ipad 节点并包含四个支持的值。

<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeRight</string>

但还是不能正常工作...

有什么建议吗?

谢谢,

伊万

【问题讨论】:

  • 如果我检查设备方向是 UIDeviceOrientationUnknown ... 虽然 [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];之前已经执行过

标签: xcode ipad orientation


【解决方案1】:

在 XCode 中,选择“导航器”面板中的“项目导航器”选项卡,然后单击列表最顶部的应用程序名称。在主编辑器区域,您应该在左侧看到一个目标列表,选择您的主要目标。在主编辑器的右侧,转到“摘要”,然后选择“支持的设备方向”。

注意:我使用的是 Xcode 4.3(至少在 4.2 中也是如此)。

【讨论】:

    【解决方案2】:

    将此行添加到 AppDelegate

    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-20
      • 2012-03-27
      • 1970-01-01
      • 2011-03-25
      • 1970-01-01
      • 2021-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多