iOS13开始苹果引入了暗黑模式(DarkMode),在黑暗模式下,系统界面配色都会相应变暗,同时App也需要进行适配。
HBuilderX2.6.3+版本开始支持对暗黑模式的适配处理。
全局开启暗黑模式
为了保证应用的兼容性,HBuilderX打包生成的App默认已关闭兼容暗黑模式,需按以下方法配置开启暗黑模式。
如果不开启黑暗模式,将无法获取当前系统的外观模式
打开项目的manifest.json文件,切换到“源码视图”项
- uni-app项目
在 “app-plus” -> “distribute” -> “ios” 节点下添加 UIUserInterfaceStyle 节点"app-plus": { "distribute": { "ios": { "UIUserInterfaceStyle": "Automatic", //... }, //... }, //...
- 5+ App(WAP2APP)项目
在 “plus” -> “distribute” -> “apple” 节点下添加 UIUserInterfaceStyle 节点"plus": { "distribute": { "apple": { "UIUserInterfaceStyle": "Automatic", //... }, //... }, //...
保存后,