Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent a UIButton from highlighting when pressed?

When an UIButton is pressed, the normal situation is that it will be highlighted i.e. a shadow like layer will cover the image. Is there a way to prevent this from happening? Is there an attribute to handle this?

like image 484
xcoder Avatar asked Jun 13 '11 16:06

xcoder


People also ask

How to disable UIButton highlight on click?

After the introduction of Style , you have to set the style to Default in IB along with setting the type to Custom to be able to disable the highlighting effect completely. Otherwise your button text will keep highlighting. *Setting the Style to Default resets the text color to white. Save this answer.

What is a UIButton?

A control that executes your custom code in response to user interactions.

What is button in ios swift?

It is a control that enables the user to interact with the application. It is used to trigger the events performed by the user. It executes the custom code in response to user interactions. class UIButton : UIControl.


1 Answers

You normally don't press a button with Xcode, you use your finger (or mouse). But nitpicking aside: adjustsImageWhenHighlighted set to NO will do the trick.

like image 115
Johan Kool Avatar answered Oct 07 '22 23:10

Johan Kool