Prevent 180 degree flip iOS Cordova

我们两清 提交于 2019-12-12 06:48:24

问题


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?


回答1:


You can disable this by unchecking the upside down orientation in Xcode.




回答2:


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');



来源:https://stackoverflow.com/questions/44491204/prevent-180-degree-flip-ios-cordova

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!