Pergunta

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) enter image description here

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.

Foi útil?

Solução 2

Solution found:

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top