[英]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.