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.
Asked
Active
Viewed 2,939 times
2
-
May this help you - [How to change Status Bar text color in iOS 7](https://stackoverflow.com/questions/17678881/how-to-change-status-bar-text-color-in-ios-7?rq=1) – Krunal Jan 29 '18 at 13:02
-
i want the color of my choice. – Muhammad Haris Rafiq Jan 29 '18 at 13:09
2 Answers
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
-
-
This approach is deprecated since iOS 9. However, I still use it too, because it's much more flexible than the "correct" `preferredStatusBarStyle` approach... – LinusGeffarth Nov 28 '18 at 15:54