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
Yes, alpha=0.0f;
and hidden=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:
-(void)hideOverlayButton
{
[UIView beginAnimations:@"hideOverlayButton" context:nil];
[UIView setAnimationDuration:0.2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[self.overlayButton setAlpha:0.0];
[UIVIew commitAnimations];
}
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.