美文网首页
Dark mode 模式下更改StatusBar

Dark mode 模式下更改StatusBar

作者: JohnXych | 来源:发表于2019-12-20 10:55 被阅读0次

    夜间/深色模式 DarkMode

    夜间模式是iOS13的重要更新之一,随之而来的是我们能从系统设置中“显示与亮度”中选择“浅色”、“深色”两种模式,并且可以设置自动切换。(“控制中心”亮度调节中也可直接调节)

    已知问题:在系统设置为深色模式时候,无法更改StateBar颜色

    如果不想适配深色模式 (1).直接在项目的plist文件中设置 UIUserInterfaceStyle UIUserInterfaceStyleLight

    (2).在每个UIViewController或者BaseViewController(如果自己有的话),中设置

     if (@available(iOS 13.0, *)){

     self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;

     }

    适配深色模式 首先我们要看一下显示模式的枚举值

    typedef NS_ENUM(NSInteger, UIUserInterfaceStyle) {

    UIUserInterfaceStyleUnspecified,

    UIUserInterfaceStyleLight,

    UIUserInterfaceStyleDark,

    } API_AVAILABLE(tvos(10.0)) API_AVAILABLE(ios(12.0)) API_UNAVAILABLE(watchos);

    原文链接:https://blog.csdn.net/qq_38464250/article/details/93047409

    相关文章

      网友评论

          本文标题:Dark mode 模式下更改StatusBar

          本文链接:https://www.haomeiwen.com/subject/nxcvnctx.html