【问题标题】:UIInterfaceOrientation cannot determine interface orientation on iOS 7 and iOS 8 iPhonesUIInterfaceOrientation 无法确定 iOS 7 和 iOS 8 iPhone 上的界面方向
【发布时间】:2016-02-19 10:08:06
【问题描述】:

我设置了一个函数来确定设备的界面方向如下。

if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
    {
        [self layoutPortrait:self.view];
        NSLog(@"UIInterfaceOrientationIsPortrait");
    }
    else if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
    {
        [self layoutLandscape:self.view];
        NSLog(@"UIInterfaceOrientationIsLandscape");
    }
    else
    {
        [self layoutPortrait:self.view];
        NSLog(@"Unknow Interface Orientation!");
    }

我总是把我的设备放在桌子上,界面方向是纵向的。 但是,它在编译时会打印“UIInterfaceOrientationIsLandscape”,并且它只发生在 iOS 7 和 iOS 8 iPhone 上,但 iPad 和任何 iOS 9 设备上。 我不知道如何让它确定正确的方向。

【问题讨论】:

  • UIDeviceOrientation 怎么样?
  • 我也尝试过 UIDeviceOrientation,但 iOS7 和 iOS 8 iPhone 都打印了“UIDeviceOrientationUnknown”,并且该应用在启动时仍以横向显示。
  • 愚蠢的问题你开始收听方向变化通知了吗?
  • 你试过检查状态栏[[UIApplication sharedApplication] statusBarOrientation]的方向了吗?
  • 我试过了....也没有用。

标签: ios objective-c landscape uiinterfaceorientation portrait


【解决方案1】:

对于 io9 也是如此,尝试看看这个用例是否真的需要。 大多数时候我认为这是微不足道的。

【讨论】:

  • 我不确定苹果中是否已经存在错误,我认为困难是由于我们在 x 和 y 方向都需要额外的“G”传感器,今天我认为我们只有一个轴上的传感器.在修复之前,最好修改用例/UX 以使其不被注意。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-10
  • 2015-01-24
相关资源
最近更新 更多