UINavigationBar appearance setBackgroundImage Hides Status Bar

1.1k views Asked by At
UIImage *gradientImage46 = [[UIImage imageNamed:@"navbar.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];


 [UINavigationBar appearance] setBackgroundImage:gradientImage46
                                           forBarMetrics:UIBarMetricsDefault];

I am using this to customize the appearance of my navigation bars in my app. However, this is causing the status bar to be solid black, showing nothing...time, carrier, battery, etc. Is this a bug, or did I implement this incorrect?

I have this running in a tab bar using MainWindow.xib method for interface. The first tab is just a navigation controller with a view controller inside it. Another tab is a Navigation Controller with a TableView Controller inside. If I go from one tab to the table view, and then back, the status bar appears.

The navbar.png is 320 x 44 pixels.

1

There are 1 answers

1
Ilario On BEST ANSWER

I also have this problem bringing my app from iOS 6 to iOS7, I solved by changing the code in this way:

instead

[UINavigationBar appearance] setBackgroundImage:gradientImage46
                                       forBarMetrics:UIBarMetricsDefault];

i use

-(void) viewWillAppear:(BOOL)animated {

  [self.navigationController.navigationBar setBackgroundImage:gradientImage46 forBarMetrics:UIBarMetricsDefault];
}