个人博客导航页(点击右侧链接即可打开个人博客):大牛带你入门技术栈
iOS13 适配 夜间模式与其他
- 夜间模式
- 其他问题:presentViewController
###一 :夜间/深色模式 DarkMode
夜间模式是iOS13的重要更新之一,随之而来的是我们能从系统设置中“显示与亮度”中选择“浅色”、“深色”两种模式,并且可以设置自动切换。(“控制中心”亮度调节中也可直接调节)
已知问题:在系统设置为深色模式时候,无法更改StateBar颜色
-
如果不想适配深色模式 (1).直接在项目的plist文件中设置
<key>UIUserInterfaceStyle</key> <string>UIUserInterfaceStyleLight</string>
(2).在每个UIViewController或者BaseViewController(如果自己有的话),中设置
if (@available(iOS 13.0, *)){ self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; }
-
适配深色模式 首先我们要看一下显示模式的枚举值
typedef NS_ENUM(NSInteger, UIUserInterfaceStyle) {
UIUserInterfaceStyleUnspecified,
UIUserInterfaceStyleLight,
UIUse