kbanman kbanman - 2 years ago 88
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.


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download