Skip to content Skip to sidebar Skip to footer

Cordova 3.x Forcing Screen Orientation At Run-time Ios

I'm building an app with cordova where forcing screen orientation at runtime on certain pages is crucial. I found a plugin com.phonegap.plugins.OrientationLock that works very well

Solution 1:

Updated response:

I just found a plugin that enables this: https://github.com/Adlotto/cordova-plugin-recheck-screen-orientation.

Tested and verified on an iPhone 5 with iOS 7.1 - hooray!

Original response:

I haven't yet found a way to force it on iOS, but it's possible to at least choose which orientations are allowed dynamically at run-time.

That requires a global shouldRotateToOrientation(degree) function that returns true or false based on the device's new orientation. More details here: https://groups.google.com/forum/#!topic/phonegap/xw7QSJVCf5I

You could, theoretically, ask the user to rotate their device when needed, and then "lock" it in place by disallowing further rotations. (Not the ideal solution, of course.)

Post a Comment for "Cordova 3.x Forcing Screen Orientation At Run-time Ios"