kbanman kbanman - 10 months ago 39
iOS Question

How to disable the highlight control state of a UIButton?

I've got a UIButton that, when selected, shouldn't change state when being touched.
The default behaviour is for it to be in UIControlStateHighlighted while being touched, and this is making me angry.



Your button must have its buttonType set to Custom.

In IB you can uncheck "Highlight adjusts image".

Programmatically you can use theButton.adjustsImageWhenHighlighted = NO;

Similiar options are available for the "disabled" state as well.