繁体   English   中英

如何在没有 xcode 的情况下禁用 react-native ios 中的应用轮换?

[英]How to disable app rotation in react-native ios without xcode?

我知道可以使用 XCode 禁用旋转,但我目前无法访问某些 Mac,然后我想知道是否有办法使用 VSCode 而不是 XCode 来做到这一点。

您可以在没有 xcode 的情况下轻松实现这一点,您只需更新项目Info.plist文件中的关键UISupportedInterfaceOrientations 尽管没有 xcode,您将无法对其进行测试。

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

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

这会将 ios 上的方向设置为纵向、横向右侧和横向左侧。 如果您只想将其显示为肖像,只需粘贴以下代码:-

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>

您可以简单地更改App.json中的方向属性

"orientation": "portrait"
"orientation": "landscape"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM