Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thedon1

macrumors 6502a
Original poster
Jun 26, 2010
529
73
Hi guys, i'm using Xcode 5 and am having some trouble that Apple WWDC video hasn't fully cleared up.

I want a semi transparent status bar. I know if i add a navigation bar, the status bar will take the same translucency and tint. This sounds good.

I currently have a Navigation Controller which shows the Navigation Bar. My screen (UIViewController) is linked to this.

I tick translucent in the attributes inspector for the navigation bar in the Navigation Controller.

My connected ViewController then shows the translucent status and navigation bar as expected.

When I go back to the Navigation Controller and change the alpha of the navigation bar, this has no impact on the connected View.


How can I change the level of transparency when using a Navigation Controller?
 
OK i'm answering my own question here, I hope it's useful to others.

It looks like you can assign a background image to the navigation bar and whatever alpha/ opacity that image has, will be picked up by the status bar.

Create your image 640x128.

Use this code
Code:
 [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"image.png"] forBarMetrics:UIBarMetricsDefault];

This will make the picture the background of the navigation bar and the status bar.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.