实现iOS项目不支持黑暗模式的方法
一:设置主题为浅色模式
在项目的Info.plist文件中,添加 UIUserInterfaceStyle,String类型,内容设置为 Light。
<key>UIUserInterfaceStyle</key>
<string>Light</string>
二:禁用黑暗模式
为了禁用黑暗模式,我们需要在AppDelegate文件中添加几行代码。找到AppDelegate.swift文件,将以下代码添加到application(_:didFinishLaunchingWithOptions:)方法中:
if #available(iOS 13.0, *) {
window?.overrideUserInterfaceStyle = .light
}