2

So let's say I have a leftView and a rightView in my iOS app. Right now both views are independently registering touches.

If I drag my finger from the leftView to the rightView, the leftView continues to register touches even though my finger is now in rightView. Unless I lift my finger up and touch the rightView again, rightView never registers a touch.

Anybody have any ideas how to deal with this?

Joe
  • 659
  • 1
  • 8
  • 17

1 Answers1

0

I had a similar issue a while back. This is covered in Event Handling Guide for iOS - Hit-Testing (Apple Documentation).

In your case, you want to implement hitTest:withEvent: to determine which view will handle the event.

Don't forget that there is a lot of flexibility in where you handle these events; whether in the subviews themselves or a common superview, or both.

Apparently - although I don't have access myself - there is a really good talk on this in the WWDC 2009 "Session 103 - Processing Multi-Touch Events on iPhone".

Also see How to "transfer" first responder from one UIView to another?

Community
  • 1
  • 1
Max MacLeod
  • 26,115
  • 13
  • 104
  • 132