Question

I colorized orange my Navigation bar with:

navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.88 green:0.52 blue:0.27 alpha:1];

Everything works ok, every button is as orange as the bar, but when ic cames to a custom right item menu, it shows it blue. This is a screenshot: http://img146.imageshack.us/img146/5605/schermata20091202a14565.png

and this is the code for the right buttons:

UIView *container = [[UIView alloc] init];
UIToolbar *tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];

NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:2];

UIBarButtonItem *bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addGadget:)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];

bi = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"less.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(setEditing:)];
[buttons addObject:bi];
[bi release];

[tools setItems:buttons animated:NO];
[buttons release];

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];

How to make everything to be orange?

Was it helpful?

Solution

You should set the tintColor of the UIToolbar object to be the same as that of the UINavigationBar.

Note that a UIToolbar is not the same as a UINavigationBar, the background gradient/color is a bit different. Try setting the backgroundColor of the UIToolbar to +[UIColor clearColor]

Also, you probably don't even need the container UIView, since UIToolbar is a subclass of UIView, so you can use it as customView just by itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top