简体   繁体   中英

How can I give textcolor in status bar?

Text color of the wordings in status bar cannot be changed. Status Bar background color is able to change. How can I change the text color in that?

Use -

UIApplication.shared.statusBarStyle = .lightContent // Light content, for use on dark backgrounds

or

UIApplication.shared.statusBarStyle = .default // Dark content, for use on light backgrounds

Don't forget to edit "View controller-based status bar appearance" in info.plist and set it to NO.

How can I give textcolor in status bar?

You can't!

The only thing that you could do is to change the UIStatusBarStyle , which could be one of the two following options:

  • default :

A dark status bar, intended for use on light backgrounds.

在此处输入图片说明

  • lightContent :

A light status bar, intended for use on dark backgrounds.

在此处输入图片说明

So, if you are aiming to change the color of the elements in the status bar (black color in first screenshot and white color in second screenshot) to gray -for instance-, that would be not possible, you have to stick of one of the mentioned two options.


How to change the status bar style?

You could check the following answered question to implement it:

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