Question

Now i Am using Xcode 4.2 to develop app.and the app is running on iOS 7 iPhone.My problem related with status bar color.I want the status bar color is same color as of navigation bar color.I am using this code for setting navigation bar image ,here is my code:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bar.png"] forBarMetrics:UIBarMetricsDefault];

How we can set the status bar color?now is light gray color>>Many thanks....

Was it helpful?

Solution

In iOS6 you can't change the image or the color of the status bar apart from this 2 styles:

[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];

[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

OTHER TIPS

chakra's suggestion to add the line of code:

self.navigationController?.navigationBar.isTranslucent = false

works. Add it to your function in the swift files of your controllers. This allows the status bar to be the same color as the navigation bar. I added this as an answer instead of a comment, because I cannot add comments to other answers as yet. The line of code above this line of code does not work for me though.

This works:

self.navigationController?.navigationBar.barTintColor  = UIColor.untSimeioblue
self.navigationController?.navigationBar.isTranslucent = false
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top