1

I am trying to edit the background behind the backBarButtonItem as it insists on remaining white. I have edited the background color of the entire navigation bar but to no avail.

It only seems to affect iOS4 however, seeing as the:

[self.navigationController.navigationBar setBackgroundImage:navBarBackground forBarMetrics:UIBarMetricsDefault];

code works on iOS5. I have also tried to edit the navigation bar using this method also:

@implementation UINavigationBar (UINavigationBarCategory)
-(void)drawRect:(CGRect)rect{
UIImage *img = [UIImage imageNamed:@"bg_actionbar_edit.png"];
[img drawInRect:rect];
}
@end;

however this code results in all of my navigation bars to change, which is something that I do not want. Is there any simple code that I could use to simply change the BG colour of a buttonItem based on the navigation bar?

Andy Shephard
  • 1,726
  • 17
  • 26
  • Set a tag for each navigation bar and check tag for navigationBar before you set an image.Put an if condition to check the tag number of a navigation item. – Dinesh Raja Apr 06 '12 at 12:57

1 Answers1

1

Set the tint of your navigation bar to change the color of the navigation bar button items:

self.navigationController.navigationBar.tintColor = [UIColor grayColor];
Darren
  • 10,091
  • 18
  • 65
  • 108
  • Unfortunately, this has no effect for me. I am still left with the same issue of having the Back Button remaining with a white background that I am unable to change. I believe it is due to a previous implementation of the UINavigationBar code on the AppDelegate file. – Andy Shephard Apr 10 '12 at 08:47
  • Maybe you could post some more code, with what you're doing with the navigation bar and the bar button items. I believe that you have to set the tintColor after adding the buttons to the navigation bar, if that's not what you're already doing. – Darren Apr 10 '12 at 12:00