ios 应用程序中的 ionic 3 屏幕方向问题

ionic 3 screen orientation issue in ios application

我想将我的其中一个页面锁定为横向模式,它在 android 中完美运行,但在 Ios 中却不行,我无法旋转它以使其仍然处于纵向模式。我必须更改 Xcode 设置中的任何内容吗?我不知道到底发生了什么。

我用过类似的东西

ionViewDidLoad() {
 this.screenOrientation.lock('landscape');
}

您需要在 Xcode 中启用它。在 General 选项卡中,查找 Deployment info,然后选中 Landscape LeftLandscape Right 复选框:

我在使用 Cordova(我使用 DevExtreme)时遇到了类似的问题。screenOrientation.lock('landscape') 但现在使用 screen.orientation.lock('landscape');

这是我用的插件+代码

<plugin name="cordova-plugin-screen-orientation" />

screen.orientation.lock('portrait');
screen.orientation.lock('landscape');
screen.orientation.unlock();

this.ScreenOrientation.lock(this.ScreenOrientation.ORIENTATIONS.LANDSCAPE)