Cordova 3.x在运行时IOS强制屏幕方向 [英] Cordova 3.x forcing screen orientation at run-time IOS
问题描述
我正在使用cordova构建一个应用程序,在某些页面上强制屏幕方向在运行时是至关重要的。我发现一个插件com.phonegap.plugins.OrientationLock在Android设备上工作得很好,但我找不到任何解决方案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 on android devices but I can't find any solution for IOS... Have anyone solved this issue? Thank you
推荐答案
更新回应:
我刚刚找到一个插件,可以实现这一点: https://github.com/ Adlotto / cordova-plugin-recheck-screen-orientation 。
I just found a plugin that enables this: https://github.com/Adlotto/cordova-plugin-recheck-screen-orientation.
在iOS 7.1的iPhone 5上测试和验证 - hooray!
Tested and verified on an iPhone 5 with iOS 7.1 - hooray!
原始回应:
我还没有找到办法强制 >
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.
这需要一个全局的shouldRotateToOrientation()方法,这个方法需要在运行时动态地执行。度)函数,根据设备的新方向返回true或false。更多详细信息: https://groups.google.com/forum/#!topic / phonegap / xw7QSJVCf5I
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.)
这篇关于Cordova 3.x在运行时IOS强制屏幕方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!