So I created a glass pane or a custom UIView to handle touches. This glass pane sits on top of other views such as dummy UIButtons. When I set the alpha to be 0, the touches actually get intercepted by the views underneath the glass view. This is wrong. However, when I set the alpha to a low value like 0.2, the glass pane intercepts the touches.
The alpha setting was done in Interface Builder.
Anybody know how to set to the alpha to 0 and still get have this glass pane intercept touches?
Yes,
alpha=0.0f;
andhidden=YES;
have the same effect. This is very useful, because you can animate a fade-out and not have to worry about touches on the invisible object - ie you can say:Then, when the animation is complete, the button won't respond to touches - there's no need to worry about deactivating it.
If what you want is to have invisible buttons, put a UIButton on the view, make sure it's at the front (bottom of the list in interface builder), set it's type to custom; don't set an image, background image or title. By default in interface builder you'll get alpha of 1 and a clear color.Then you can wire-up the IBOutlets in the usual way.
Yes, it is standard behaviour.
For example, you can just set clear background of that
UIView
:In such case user wouldn't see that view - I assume that you want to do exactly that?