Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set UIButton's Highlight Tint color programmatically?

There is a Highlight Tint option in Interface Builder for UIButton. Is it possible to change it programmatically for all UIButton in iOS 5....using some kind of appearance protocol thing or some other workaround?

like image 275
orak Avatar asked Oct 30 '12 06:10

orak


1 Answers

You can set it as

[button setTintColor:[UIColor grayColor]];

This is equivalent to hightlight tint option in IB and is applied only for highlighted state.

Update: In order to implement this for all the buttons in app, use this:

[[UIButton appearance] setTintColor:[UIColor orangeColor]]; 

It will set for all the UIButton which you are going to use in your app.

Check this for more details on UIAppearance protocol.

like image 121
iDev Avatar answered Nov 15 '22 16:11

iDev