Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button color in Navigation bar - iPhone

How do you to set the tint of this yellow button to be gray? I have tried adding an image, but have had no luck.

Here is the screenshot:

alt text

Here is my current code:

- (id)initWithStyle:(UITableViewStyle)style {
    if (self = [super initWithStyle:style]) {

        UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
                                      initWithTitle:NSLocalizedString(@"Settings", @"")
                                      style:UIBarButtonItemStyleDone
                                      target:self
                                      action:@selector(GoToSettings)];
        [addButton setImage:[[UIImage imageNamed:@"bg_table.png"] retain]];

        self.navigationItem.rightBarButtonItem = addButton;
        self.navigationItem.hidesBackButton = TRUE;
        self.view.backgroundColor = [UIColor blackColor];
    }
    return self;
}
like image 262
Mladen Avatar asked Aug 27 '09 12:08

Mladen


2 Answers

self.navigationItem.rightBarButtonItem.tintColor = [UIColor colorWithRed:0.1f green:0.66f blue:0.26f alpha:0.7];
like image 112
K_K Avatar answered Sep 22 '22 04:09

K_K


From iOS 5.0 and on you can use:

    [[UINavigationBar appearance] setTintColor:[UIColor yellowColor]];
like image 39
JordanC Avatar answered Sep 18 '22 04:09

JordanC