Christian Gossain
Christian Gossain

Reputation: 5972

touchesEnded: not detecting end of touch properly?

I'm using the touchesEnded: method to do some work when I lift a finger off my UIScrollView, but my problem (and i've confirmed using NSLog) is that the touchesEnded: method seems to only get called when I tap on my scroll view and not when I touch and hold/slide my finger and then let go?

Is there another method I need to use? (btw i'm calling super as well)

I need a way to do stuff as soon as the user removes their fingers off the view

Upvotes: 1

Views: 546

Answers (1)

Brian
Brian

Reputation: 15706

When you simply tap, the scroll view will pass touches through to its subviews. But if you start dragging, the scrollview will send a touchesCancelled message to the subview and process the touches itself. Check out the methods on UIScrollViewDelegate - there's probably something there you can use.

Alternatively, UIScrollView has a property canCancelContentTouches. If you turn that off, its subviews will always receive touches, but of course then the scroll view won't scroll.

Upvotes: 2

Related Questions