D-Marc
D-Marc

Reputation: 3117

Prevent 180 degree flip iOS Cordova

I am using this plugin https://github.com/apache/cordova-plugin-screen-orientation for orientation and I'm doing this in config.xml file <preference name="orientation" value="portrait" />. This prevents it flipping to landscape mode, but can still file 180 degrees on my iPhone. How can I prevent this?

Upvotes: 0

Views: 710

Answers (2)

jcesarmobile
jcesarmobile

Reputation: 53361

the orientation preferences are not for the cordova-plugin-orientation, those are regular cordova preferences as as you say, portrait allows both portrait options, regular portrait and upside down.

For only allowing regular portrait you have to use portrait-primary, but not as a preference.

As you are using the cordova-plugin-orientation, you have to use it's api to lock the screen rotation, so use this after device ready fires

window.screen.orientation.lock('portrait-primary');

Upvotes: 1

Abhishek Jain
Abhishek Jain

Reputation: 485

You can disable this by unchecking the upside down orientation in Xcode.enter image description here

Upvotes: 1

Related Questions