Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView alpha = 0 causes touches to be dropped to the view below

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?

like image 520
Joe Avatar asked Nov 11 '11 07:11

Joe


1 Answers

Yes, it is standard behaviour.

For example, you can just set clear background of that UIView:

UIView *touchHandlerView;
touchHandlerView.backgroundColor = [UIColor clearColor];

In such case user wouldn't see that view - I assume that you want to do exactly that?

like image 171
Nekto Avatar answered Oct 05 '22 08:10

Nekto