wupeng wupeng - 4 years ago 95
iOS Question

How can I set the background color of statusbar?

I want to set a

color like Facebook app's
, but I can't find a way to fix it in Apple's documents. Is there any advice for me?

Answer Source

You cannot change the status bar color, as it has not background to change.

However you could create a view on 20px height and place it behind the status bar.

If you have a UINavigationBar, you could either remove the background color of a UINavigationBar or add a subview to the UINavigationBar with a height on 20px and give it the color of the status bar.

I found this on github, you can inspect the code and find out how to change the color for the top 20px https://github.com/remirobert/RRMaterialNavigationBar

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download