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:

  • How to set Status Bar Style in Swift 3.
  • Changing the Status Bar Color for specific ViewControllers using Swift in iOS8.