3
votes

is it possible to change status bar text and battery icon to specific color, for example red color?

I have read some article about this, suggesting me to use setStatusBarStyle. But I don't have option to set to specific color.

So, is it possible to do this? Thanks in advance


EDIT :

I was trying to find the answer at apple dev forum, but unfortunately I can't find it. The available color for UIStatusBar in iOS7 is black and white.

Maybe you can try Sulthan's post below, but seems not easy, at least for me. Seems need so much effort for just simple color changing. So I don't think this is possible, at least in easy way.

Anyway, thanks for helping me :)

1
I don't think that it's possible, since it's related to iOS and not to your app. What I know you can do on iOS (7) is choosing between white text color, or black text color ...KIDdAe

1 Answers

6
votes

Warning - in general, changing the color will not be received well by App Store reviewers.

  1. You can hide the default status bar and add your own. This would require displaying time, battery information, network state etc. It's not an impossible solution, not hard to implement but it will take time and it won't look exactly like the native status bar on all the devices.

  2. You can show a partially transparent view over the white status bar and change the color this way. However, it will also change the color of the status bar background.

  3. You can use undocumented API. Status bar is a system window (not returned by [UIApplication windows]) but there are ways to gain access to it (see, for example, Window Registry to gain access to all application windows). Then you can use reflection (obj.c runtime) to check which methods are available on the status bar and try to change the colors (see UIStatusBar and UIStatusBarWindow) It also might be possible to draw the native status bar into an image, replace white pixels with colored pixels and then draw the resulting image over the original status bar.