I have a UIControl (or UIView, doesn't matter which) and this is covered by another UIControl. The other UIControl reacts nicely on touch events. However, the underlying UIControl also needs to know about the touch and if it was actually "on it" or not from the user's perspective. The covering UIControl is partially transparent.
How can I catch this touch on the underlying UIControl?
I think there are couple ways you could go about this...
You could pass the touch event on to the other control...though i don't think that'll work if you're moving the upper view over the other view? You might have to experiment.
The easier way might be just to see if the lower rect contains the touch point:
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent*)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self];
if (CGRectContainsPoint(lowerView.frame, touchLocation)) {
<doyourthing>
}
I don't recall offhand but you may need to convert the view coordinates between the two views?!? or you could ask the view itself with - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event