【问题标题】:Can't normally lock landscape orientation on iPhone无法在 iPhone 上正常锁定横向
【发布时间】:2019-03-05 23:03:05
【问题描述】:

我正在为 JavaScript 使用 Screen Orientation API (https://www.w3.org/TR/screen-orientation/)。 我有以下问题: 当我将 iPhone 转到横向位置时(按钮在左侧,自拍相机在右侧),它会正常旋转屏幕,但在我调用 screen.orientation.lock('landscape') 后,它会旋转屏幕并倒置显示屏幕。 它不会发生在android上。在 android 上调用 screen.orientation.lock('landscape') 时,屏幕按预期保持在横向模式。 您能否说一下,如何解决这个问题?

【问题讨论】:

    标签: javascript ios screen-orientation


    【解决方案1】:

    事实证明,这是 Screen Orientation API 的已知问题。 它甚至在其库的 github 中提到:https://github.com/apache/cordova-plugin-screen-orientation/issues/42 并且问题仍然存在。 所以在我的情况下,我只是锁定了当前景观的方向,例如如果它是“横向二级”,那么我使用screen.orientation.lock('landscape-primary')。为什么是“初级”?因为它混淆了,如果你现在在横向辅助并锁定横向辅助,那么它无论如何都会旋转到横向主要。 所以答案是图书馆的问题。

    【讨论】:

      猜你喜欢
      • 2011-04-11
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-11
      • 1970-01-01
      • 2023-03-11
      相关资源
      最近更新 更多