2

I am working on a game in PhoneGap. My game needs the screen to be "locked" into landscape mode. I need it to be locked so that you can't turn the device into the other landscape mode, rotating the screen (so, no matter which way the device is rotated, the screen will not change orientations. It will stay the same way as it was before). I have tried looking at this question, but it didn't work for me. I need a solution that I can use easily, and preferably with Android and iOS. I am using the tools for PhoneGap, so in the terminal, I run:

phonegap run android

to build and install my app onto my tablet.

4

2 回答 2

3

在 IOS 中锁定方向:只需在 Xcode 中打开项目并单击项目和内部摘要,您可以选择方向 在此处输入图像描述

对于 Android 添加android:screenOrientation="landscape"到每个活动,例如:

<activity android:name=".SomeActivity"
          android:label="@string/app_name"
          android:screenOrientation="landscape">
于 2013-08-28T04:54:36.557 回答
1

我必须执行以下操作(cordova 3.3):在 *-info.plist - 我有:

   <key>UISupportedInterfaceOrientations</key>
   <array/>
   <key>UISupportedInterfaceOrientations~ipad</key>
   <array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
   </array>

我将其更改为:

<key>UISupportedInterfaceOrientations</key>
<array/>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
于 2014-02-23T10:14:41.633 回答