简体   繁体   English

如何在 iOS 13.0+ 中使用 statusBarManager 更改 statusBarStyle

[英]How do I change the statusBarStyle using the statusBarManager in iOS 13.0+

I am trying to change the status bar style in my iOS 13.0 app but when I use the code;我正在尝试更改我的 iOS 13.0 应用程序中的状态栏样式,但是当我使用代码时;

   UIApplication.shared.statusBarStyle = .lightContent

I get the warning in Xcode;我在 Xcode 收到警告;

   'statusBarStyle' was deprecated in iOS 13.0: Use the statusBarManager property of the window scene instead

The problem is that the property statusBarManager?.statusBarStyle is a get only property so how can I change the status bar style programmatically?问题是属性statusBarManager?.statusBarStyle是一个只获取属性,所以我如何以编程方式更改状态栏样式?

Set View controller-based status bar appearance key value in info.plist to NO and programmatically set UIApplication.shared.statusBarStyle to either.lightContent or.default.将 info.plist 中基于视图控制器的状态栏外观键值设置为 NO,并以编程方式将 UIApplication.shared.statusBarStyle 设置为 .lightContent 或 .default。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM