简体   繁体   中英

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;

   UIApplication.shared.statusBarStyle = .lightContent

I get the warning in 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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