uniapp ios横屏
时间: 2023-09-02 18:15:53 浏览: 193
Uniapp支持iOS横屏,需要在manifest.json文件中进行配置。
1. 配置manifest.json文件
在manifest.json文件中添加如下代码:
```
"app-plus": {
"ios": {
"orientation": "landscape" // 设置横屏
}
}
```
2. 配置Info.plist文件
在Info.plist文件中添加如下代码:
```
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
```
3. 配置App.vue文件
在App.vue文件中添加如下代码:
```
<style>
.app {
transform: rotate(90deg); // 旋转90度
transform-origin: center center; // 旋转中心点
width: 100%;
height: 100%;
}
</style>
```
以上就是Uniapp在iOS上实现横屏的配置方法。需注意,iOS设备的横屏和竖屏显示方式是由设备自身的旋转锁定开关决定的,如果用户在设备上开启了旋转锁定,则无法实现横屏显示。
阅读全文
相关推荐


















