2

How to change the text color of status bar content. i want color like yellow ,green etc. not system provided style I has changed the color of status bar but not changing the text color of status bar.

2 Answers2

3

You can switch between dark and light color by overriding preferredStatusBarStyle in a viewController:

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}

However, you have two options only, either .default or .lightContent, for dark text color and light text color, respectively. You cannot use any color that you want. Although I can imagine implementing your own custom status bar, and hiding the system status bar - although you might have difficulties getting to all the system info that the system status bar presents.

Milan Nosáľ
  • 19,169
  • 4
  • 55
  • 90
3

you can change using below code . Place this code in app Delegate in method

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
     UINavigationBar.appearance().barStyle = .blackTranslucent

} 

or

UINavigationBar.appearance().barStyle =.lightContent 

You can't set custom color to it .

Dhiru
  • 3,040
  • 3
  • 25
  • 69