UIBarButtonItem with color?
Is it possible to have a red UIBarButtonItem?
If anyone is looking for code to exactly duplicate a simple UIBarButtonItem:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:@"delete.png"] forState:UIControlStateNormal];
[button setTitle:@"Delete" forState:UIControlStateNormal];
button.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.0f];
[button.layer setCornerRadius:4.0f];
[button.layer setMasksToBounds:YES];
[button.layer setBorderWidth:1.0f];
[button.layer setBorderColor: [[UIColor grayColor] CGColor]];
button.frame=CGRectMake(0.0, 100.0, 60.0, 30.0);
[button addTarget:self action:@selector(batchDelete) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem* deleteItem = [[UIBarButtonItem alloc] initWithCustomView:button];
And delete.png is:
Why not just :
[[self editButtonItem] setTintColor:[UIColor redColor]];
(on sdk 4.* , ios 5 and up)