views:

755

answers:

3

Hello!

I'm trying to create a transparent button in my iPhone app -- to create an Easter Egg of sorts. How would I go about setting the button to be transparent without touching the alpha (when alpha = 0.0 on a UIButton, it no longer responds to touch)?

Thanks. :)

+1  A: 

You could set the alpha to a very small value.

Or, you could create a blank, clear UIImage and use a custom button style, and set it to the button's image.

chpwn
Dangit chpwn, trying to take my stack overflow answers! It's ok, my way is better :)
Charybdis
Alpha to a very small value = "ghost" effect, not very professional.Thanks for the second tip, it worked. :)
esqew
A: 

Can you create an image as a button? Or use the button background the same color as the background (same effect as being transparent)?

Nippysaurus
+4  A: 

Set your button type to UIButtonTypeCustom and it will have no styling. (thus, it should be "invisible").

Charybdis
he's right, this way is better >:-)
Jeremy White