Need multiple views to respond to a touch event in an iPhone app

Posted by Joel on Stack Overflow See other posts from Stack Overflow or by Joel
Published on 2010-03-04T01:48:11Z Indexed on 2010/04/28 15:03 UTC
Read the original article Hit count: 421

Setup: I have two views that I need to respond to the touch event, and they are layered out on top of one another. View 1 is on top of View 2. View 2 is a UIWebView. View 1 is sublclassed to capture the touch event.

My problem is that if I try to call the UIWebView event handlers (touchesBegan: and touchesEnded:) from within the event handlers of View 1, which is the first responder, nothing happens. However if I set View 1 to userInteractionEnabled = NO, then the touch goes through that view and is processed properly by the 2nd view.

Any ideas on how I can have 2 views respond to a touch event? Unfortunately the 2nd view is a UIWebView, so I need to actually call the event handler and not a different method, etc...

Thanks in advance for any advice, Joel

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiwebview