如何將此黃色按鈕的色調設置爲灰色?我試圖添加一個圖像,但沒有運氣。導航欄中的按鈕顏色 - iPhone
下面是截圖:
這裏是我當前的代碼:
- (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;
}
是否可以給它一些顏色,例如灰色? – Mladen 2009-08-27 16:50:26
addButton.tintColor = [UIColor grayColor]; – charliehorse55 2012-06-06 19:26:33