UIButton gains a dark color when it is selected (I want to avoid this)

I am developing an iOS 4 application.

I use custom uibutton to make the image clickable. When the user clicks on the image, he will disappear.

It is not very nice to see that the image turns black, then refers to its original color, and then disappears.

Is there any way to disable this effect?

+7
source share
4 answers

You will need to set the adjustsImageWhenHighlighted property to NO:

 [button setAdjustsImageWhenHighlighted:NO]; 

Alternatively, you can set the same image for all button controls.

+18
source

You need to set the Shows Touch On Highlight property to enable.

Programmatically, you can do this with

 [button setShowsTouchWhenHighlighted:YES]; 
+2
source

Since this is a custom button, you can specify the image that you want to display when it is selected. Create the image that you want to display in this situation.

+1
source

If you use the interface designer, simply set the selected and selected states to the same image as the default image.

0
source