iOS开发 iOS13禁用深色模式

From: https://blog.csdn.net/xunzhaoyulong/article/details/101288729

全局禁用深色模式(暗黑模式)

在Info.plist中增加UIUserInterfaceStyle,值为Light,如下


    UIUserInterfaceStyle

    Light

如果想要在某个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

你可能感兴趣的:(iOS开发 iOS13禁用深色模式)