Is there some optimization going on that removes the view or something? I still want it to recieve touch events even though I've made it transparent. Seems these events don't fire if alpha == 0 though.
views:
138answers:
1
+1
A:
You're right, touches don't get detected on transparent views:
"By default, a view receives touch events, but you can set its userInteractionEnabled property to NO to turn off delivery of events. A view also does not receive events if it’s hidden or if it’s transparent."
How about setting the view to 1% alpha, or even a few points? Maybe your UI should show a ghost overlay anyways.
The other thing you could do is make a UIView subclass, frame it to the same size, and overlay it. A UIView has a background color of [UIColor clearColor] by default, but you can still detect touches on it.
Andrew Johnson
2010-02-07 03:48:23
Thanks for reading the docs for me :)
morgancodes
2010-02-07 03:56:47
Setting the alpha to 0.001 has the same effect as setting it to zero. Seems to me your clearcolor view is a safer/better approach.
morgancodes
2010-02-07 04:04:42
Touches are ignored when the alpha of a view is less than 0.1.
Ian Henry
2010-02-07 04:30:22