A view "transparent" to touches in some areas
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-05-09T01:51:50Z
Indexed on
2010/05/09
1:58 UTC
Read the original article
Hit count: 354
I have this transparent view that covers the whole screen. I using this view to group objects because I need to run them together around a specific anchor point. Lets call this view transparentView.
At some point, transparentView contains two subviews. Two vertical bars full of icons, one on the left and one on the right of the screen. I need these bars and their icons to respond to touches, so I have to set transparentView setUserInteraction to YES.
The area between the two vertical bars are totally transparent.
transparentView is on top of other views and I need these other views to respond to taps but, the transparent area of transparentView are intercepting the taps and not letting them go thru to the view below.
This transparent view is a UIImageView based class. I have tried to forward taps on that class, using
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesBegan: touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesMoved: touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesEnded: touches withEvent:event];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesEnded:touches withEvent:event];
}
but this is not working.
How can I do that?
thanks.
© Stack Overflow or respective owner