Eli
Eli

Reputation: 768

Set Color of Status bar of specific view controller - Swift

enter image description here

How do i setup this view controller so that the Status bar that is currently white is blue like the navigation bar i dragged in?

Upvotes: 1

Views: 417

Answers (1)

AaoIi
AaoIi

Reputation: 8396

Here is one way to change the color of status bar:

1- Create a png photo with 64 height and 320 width,the first 20 height of the image will be your status bar color, and the bottom 44 pixels will be he navigation bar color, like: enter image description here

2- Uncheck the navigation bar translucent property from storyboard,so if tableview rows coming under the navigation bar while scrolling will not show, its like a solid image : enter image description here

3- Add the photo you just created to assets , and place the code to change bar color in viewDidLoad:

self.navigationController!.navigationBar.setBackgroundImage(UIImage(named: "yourphotoname"), forBarMetrics : .Default)

Upvotes: 1

Related Questions