gpt4 book ai didi

javascript - 为 Phonegap/Cordova iOS 应用强制执行正确的方向横向模式

转载 作者:可可西里 更新时间:2023-11-01 05:54:20 24 4
gpt4 key购买 nike

是否可以强制您的 Phonegap 应用仅使用正确的横向模式?

我知道这对于 native iOS 应用程序是可行的(请参阅 Xcode 中设置的屏幕截图)enter image description here

我唯一能找到的 Phonegap 是 config.xml 中的方向首选项:

<preference name="orientation" value="landscape" />

此首选项强制以横向模式显示应用程序,但允许您将屏幕旋转 180 度。这不是想要的结果。

最佳答案

iOS 版

在config.xml中设置:

<preference name="orientation" value="landscape"></preference>

<preference name="orientation" value="portrait"></preference>

在“UISupportedInterfaceOrientations”资源文件夹下ios文件夹的“ProjectName”-info.plist文件中设置:

UIInterfaceOrientationLandscapeLeft

UIInterfaceOrientationLandscapeRight

对于纵向:

UIInterfaceOrientationPortrait

UIInterfaceOrientationPortraitUpsideDown

包括适用于您的要求的内容。

关于javascript - 为 Phonegap/Cordova iOS 应用强制执行正确的方向横向模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22561473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com