Button color in Navigation bar - iPhone

前端 未结 6 1372
独厮守ぢ
独厮守ぢ 2020-12-09 20:53

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:

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 21:51

     UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
     [button setBackgroundImage:[UIImage imageNamed:@"button_main.png"]
                                           forState:UIControlStateNormal];
     [button addTarget:self action:@selector(GotoSettings)
                  forControlEvents:UIControlEventTouchUpInside];
     button.frame = CGRectMake(x, y, x1, x2);
    
     UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:menu];
     self.navigationItem.rightBarButtonItem = menuButton;
    
     [button release];
     [menuButton release];
    

提交回复
热议问题