iOS开发 iOS13禁用深色模式
2020-03-27 本文已影响0人
YY110
From: https://blog.csdn.net/xunzhaoyulong/article/details/101288729
全局禁用深色模式(暗黑模式)
在Info.plist中增加UIUserInterfaceStyle
,值为Light
,如下
<key>UIUserInterfaceStyle</key>
<string>Light</string>
如果想要在某个UIViewController
中禁用深色模式
请增加如下代码
object-C
-(UIUserInterfaceStyle)overrideUserInterfaceStyle{
return UIUserInterfaceStyleLight;
}
swift
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 13.0, *) {
overrideUserInterfaceStyle = .light
}
如果要适配深色,请移步https://xiaozhuanlan.com/topic/1064789253#sectionios
参考链接:https://stackoverflow.com/questions/56546267/ios-13-disable-dark-mode-changes