Minhal Khan Minhal Khan - 1 year ago 111
Swift Question

Changing status bar background

I want the status bar to have a darker tone than the navigation bar? how can i implement this in Swift 2.0 in IOS 9
An exmaple is as attached:enter image description here

I am able to turn the status bars text to white but not the background to a darker tone then the navigation bar? Would i need to a add a separate view over it? And if so how because i cant get it on top of the navigation bar?

Answer Source

You just need to add a new UIView and set it to the appropriate colour. Either give it a frame or add constraints so it sits at the top.

Its height should be the height of the status bar (which is usually 20 I believe but you can get this programatically as well just incase it changes...or isn't present.)

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