简体   繁体   中英

Enforce right orientation landscape mode for Phonegap/Cordova iOS app

Is it possible to enforce your Phonegap app to use right landscape orientation mode only?

I know this is possible for a native iOS app (see screenshot of setting in Xcode) 在此输入图像描述

The only thing for Phonegap I can find is the orientation preference in the config.xml:

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

This preference enforces to show the app in landscape mode but allows you to rotate your screen 180 degrees. This isn't the desired result.

For IOS

In config.xml set:

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

or

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

In "ProjectName"-info.plist file in ios folder under resources folder for "UISupportedInterfaceOrientations" set:

UIInterfaceOrientationLandscapeLeft

or

UIInterfaceOrientationLandscapeRight

or

for portrait orientation:

UIInterfaceOrientationPortrait

or

UIInterfaceOrientationPortraitUpsideDown

Include which is applicable for your requirements.

Solution found:

<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
<array>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM