UIBarButtonItem with color?

Viewed 68185

Is it possible to have a red UIBarButtonItem?

11 Answers

You can create custom UIButton with your desired look and initialize your UIBarButtonItem with it as a custom view.

UIButton *button = [UIButton buttonWithType:....];
...(customize your button)...

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:button];

Using a custom image doesn't work as it just uses the alpha to render the button.

You can create a custom image for the button and use that. Else, if you have set the tintColor of your navbar or toolbar to red, the button items on these will also appear red.

Related