【问题标题】:Forcing Landscape Orientation in iOS 7.1 working, not iOS 8.0在 iOS 7.1 中强制横向方向工作,而不是 iOS 8.0
【发布时间】:2015-02-20 13:54:14
【问题描述】:

目前我正在使用以下代码将视图控制器上的方向强制为横向。

NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];

这在 IOS 7.1 目标模拟器和我的 IOS 7.1 设备上运行良好。

当尝试将其用于 IOS 8.1 时,模拟器将物理地横向旋转,但视图将保持纵向。

是否有任何解决方法或其他旋转方式。

【问题讨论】:

    标签: ios rotation orientation


    【解决方案1】:

    这可能是由于 xcode 在您的 appDelegate 中留下了一行。

    以下答案包含您需要删除的行:

    UISplitViewController rotation iOS8 not working as expected

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-21
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多