1.全局关闭暗黑模式
在Info.plist 文件中,添加
<key>UIUserInterfaceStyle</key>
<string>Light</string>
或者
if (@available(iOS 13.0, *)) {
[UIApplication sharedApplication].keyWindow.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
2.单个页面或视图关闭暗黑模式
例1:if(@available(iOS13.0, *)) {
self.view.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
例2:if(@available(iOS13.0, *)) {
self.tableView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}