1

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 on android devices but I can't find any solution for IOS... Have anyone solved this issue? Thank you

daniel
  • 1,205
  • 1
  • 10
  • 15

1 Answers1

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.)

brianglick
  • 61
  • 5