cb428 cb428 - 6 months ago 33
Swift Question

Remove UIButton highlight for all buttons in an app

I'm wondering if there's a way to remove the highlight from UIButtons in my app. I know how to do it for an individual button (

adjustsImageWhenHighlighted
) but I don't want to go through all the buttons in my app and do it. Is it possible to set
adjustsImageWhenHighlighted
to
false
in the App Delegate so it applies to all buttons?

Leo Leo
Answer

Put this code in didFinishLaunchingWithOptions

UIButton.appearance().adjustsImageWhenHighlighted = false

Then all the default value adjustsImageWhenHighlighted of UIButton is false

Comments