Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uiappearance for UIButton also changes UIBarButton image?

I am using this piece of code

[[UIButton appearance] setBackgroundImage:[UIImage imageNamed:@"button.png"] forState:UIControlStateNormal];

To change the appearance of UIButtons. This works nicely and does not affect UIBarButtonItems except for one of them (The only one that is not an auto generated "back" button) and only initially. When you touch the barbutton, it reverts back to not having a background image.

The problematic button is a UIBarButton and not an UIButton (Unless it is both, in which case the other UIBarButtons should be affected too).

A clue can be that the other UIBarButton that are not affected are all generated and not created by me in the storyboard.

This must be a bug in the api?

like image 295
Ostmeistro Avatar asked Apr 01 '26 12:04

Ostmeistro


1 Answers

Solved using setTintColor. Was an api bug that since then probably has been fixed

like image 161
Ostmeistro Avatar answered Apr 03 '26 03:04

Ostmeistro