如何在没有xcode的react本机ios中禁用应用程序旋转?

如何在没有xcode的react本机ios中禁用应用程序旋转?,ios,react-native,Ios,React Native,我知道可以使用XCode禁用旋转,但我目前没有访问某些Mac的权限,那么我想知道是否有一种方法可以使用VSCode而不是XCode来做到这一点。您只需在App.json中更改orientation属性即可 “方向”:“纵向” 或 “方向”:“横向”您只需在App.json中更改方向属性即可 “方向”:“纵向” 或 “方向”:“横向”无需xcode即可轻松实现,只需更新项目Info.plist文件中的键UISupportedInterfaceOrientations。虽然没有xcode您将无法测试

我知道可以使用XCode禁用旋转,但我目前没有访问某些Mac的权限,那么我想知道是否有一种方法可以使用VSCode而不是XCode来做到这一点。

您只需在
App.json
中更改orientation属性即可

“方向”:“纵向”


“方向”:“横向”

您只需在
App.json中更改方向属性即可

“方向”:“纵向”


“方向”:“横向”

无需xcode即可轻松实现,只需更新项目Info.plist文件中的键UISupportedInterfaceOrientations。虽然没有xcode您将无法测试它

您可以在项目Info.plist文件中搜索键UISupportedInterfaceOrientations,并按如下所示更新值。如果看不到任何此类键,只需创建一个新键和值,如下所示:-

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
UI支持接口方向
UIInterfaceOrientationPortrait
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
这会将ios上启用的方向设置为纵向、横向右侧和横向左侧。如果您只想将其纵向粘贴,只需粘贴以下代码:-

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
UI支持接口方向
UIInterfaceOrientationPortrait

无需xcode,您可以轻松实现这一点,只需更新项目Info.plist文件中的键UISupportedInterfaceOrientations。虽然没有xcode您将无法测试它

您可以在项目Info.plist文件中搜索键UISupportedInterfaceOrientations,并按如下所示更新值。如果看不到任何此类键,只需创建一个新键和值,如下所示:-

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
UI支持接口方向
UIInterfaceOrientationPortrait
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
这会将ios上启用的方向设置为纵向、横向右侧和横向左侧。如果您只想将其纵向粘贴,只需粘贴以下代码:-

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
UI支持接口方向
UIInterfaceOrientationPortrait