如何强制 Phonegap 应用仅使用正确的横屏方向?
我知道对于原生 iOS 应用程序这是可能的(请参见 Xcode 中设置的截图)
对于 Phonegap,我能找到的唯一选项是在 config.xml 中指定方向偏好:
<preference name="orientation" value="landscape" />
这个设置会强制应用在横屏模式下显示,但允许你将屏幕旋转180度。这并不是期望的结果。
如何强制 Phonegap 应用仅使用正确的横屏方向?
我知道对于原生 iOS 应用程序这是可能的(请参见 Xcode 中设置的截图)
对于 Phonegap,我能找到的唯一选项是在 config.xml 中指定方向偏好:
<preference name="orientation" value="landscape" />
这个设置会强制应用在横屏模式下显示,但允许你将屏幕旋转180度。这并不是期望的结果。
对于 IOS
在 config.xml 中设置:
<preference name="orientation" value="landscape"></preference>
或者
<preference name="orientation" value="portrait"></preference>
UIInterfaceOrientationLandscapeLeft
或者
UIInterfaceOrientationLandscapeRight
或者
对于竖屏方向:
UIInterfaceOrientationPortrait
或者
UIInterfaceOrientationPortraitUpsideDown
根据您的需求选择适用的Include。
解决方案已找到:
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</gap:config-file>
,但无法解决我的问题,即在iPad上启动应用程序时旋转方向错误。 - svante