Dick Dick - 2 years ago 188
Objective-C Question

Xcode disable UIButton title fade when tapped

When I tap or hold down on any of my UIButtons, their alpha seems to fade to about 0.1. I never added this functionality in, so I'm assuming it's automatic.

How do I disable this so that my button doesn't fade when tapped or held down? I want my button to remain at alpha 1 all the time.

I've tried

button.adjustsImageWhenHighlighted = NO;
to no avail, as well as a few other suggestions on here.

Answer Source

Did you try using the same image for both the "normal" and "highlighted" states?

Maybe showsTouchWhenHighlighted also affects the situation.

Are you using background images for your buttons too?

Are you disabling the button upon tapping? Disabling also affects appearance (unlike userInteractionEnabled).

Are you using IB/Storyboards?

As you can see, there is a number of factors that can play a role into what's happening.

Any code you can show with specifics of your situation?

Edit: If you are not using an image (you mentioned adjustsImageWhenHighlighted), then just set the button type to "custom" in IB. You won't get the system provided "default" behavior.

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