2

I have downloaded Xcode 5 GM seed and trying to run my application on it.

I have set a black image for navigation bar which works perfectly on iOS 7.

But whenever I present a view controller the navigation bar image does not get set properly. It is showing a patch.

Code :

[self.navigationController.navigationBar setBackgroundColor:[UIColor blackColor]];
[self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"top-nav-bar.png"] forBarMetrics:UIBarMetricsDefault];

enter image description here

Has anyone encountered the same issue ?

EDIT : I have similar problem as the link below. But in my case, it appears only when presenting view controller and works perfectly when pushed.

navigation controller bar is being cut off

Community
  • 1
  • 1
parilogic
  • 1,147
  • 9
  • 26

1 Answers1

1

You need to becareful about the following:

tintColor is the bar buttons and title color:

navigationBar.tintColor = [UIColor whitColor];

barTintColor is the bar background color:

navigationBar.barTintColor = [UIColor colorWithRed:6.0/255.0 green:12.0/255.0 blue:19.0/255.0 alpha:1.0];

translucent, It is YES by default in iOS7 :

navigationBar.translucent = NO;

Take a look at the below image from Apple:

enter image description here

Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
  • Ok but that dude hides the statusbar which is a very bad idea, I think your problem is with the translucent and the image height, set translucent to NO, and I think your bar bg image will be 22px more in height. – Tarek Hallak Sep 17 '13 at 09:09
  • bar bg image works perfectly when it is pushed. But it causes problem when presented. I tried your solution but no luck.. – parilogic Sep 17 '13 at 09:39