UIBarbuttonItem change textColor

I have these two buttons in the toolBar and you want to change the color of the UIBarButtons, how can I do this? I tried setTitleTextAttributes, but it looks like it has no object with this? How can i do this

UIBarButtonItem *sysDoneButton = [self createButtonWithType:UIBarButtonSystemItemDone target:self action:@selector(actionPickerDone:)]; UIBarButtonItem *sysCancelButton = [self createButtonWithType:UIBarButtonSystemItemCancel target:self action:@selector(actionPickerCancel:)]; 
+1
source share
2 answers

The color of the UIBarButtonItem is tintColor . (Or he can use tintColor , inherited from the toolbar in which you put it.)

+4
source

UIBarButtonItems does not seem to change the color of the hue after being added to the navigation bar.

What I did was create a new one instead of new attributes.

 let rightBarButtonItem = UIBarButtonItem(title: "Title", style: .plain, target: self, action: #selector(someAction)) rightBarButtonItem.tintColor = UIColor.white navigationItem.rightBarButtonItem = rightBarButtonItem 
0
source

Source: https://habr.com/ru/post/1269457/


All Articles