iOS归纳

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

上一篇下一篇

猜你喜欢

热点阅读