[英]Enforce right orientation landscape mode for Phonegap/Cordova iOS app
是否可以强制您的Phonegap应用程序仅使用正确的横向模式?
我知道这对于原生iOS应用程序是可行的(参见Xcode中的设置截图)
我可以找到的Phonegap唯一的东西是config.xml中的方向首选项:
<preference name="orientation" value="landscape" />
此首选项强制以横向模式显示应用程序,但允许您将屏幕旋转180度。 这不是理想的结果。
对于IOS
在config.xml中设置:
<preference name="orientation" value="landscape"></preference>
要么
<preference name="orientation" value="portrait"></preference>
在“ProjectName”-info.plist文件中,在“UISupportedInterfaceOrientations”的资源文件夹下的ios文件夹中设置:
UIInterfaceOrientationLandscapeLeft
要么
UIInterfaceOrientationLandscapeRight
要么
纵向:
UIInterfaceOrientationPortrait
要么
UIInterfaceOrientationPortraitUpsideDown
包括适用于您的要求。
解决方案:
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.