eugene
eugene

Reputation: 41785

Can I cancel touch programmatically?

UIScrollView has a canceling mechanism, where it cancels the touch of subviews when it detects 'scrolling'.

I wonder if I can cancel a touch event (which already has begun) programmatically.

I have a draggable view inside a scroll view.
I can let the draggable view receive touches, but I'm wondering how to stop receiving touch events when I want and give touch events to the scroll view.

Upvotes: 5

Views: 6840

Answers (3)

iHS
iHS

Reputation: 5432

You might want to have a look at the UITapGestureRecogniser class's cancelsTouchesInView method

Upvotes: 1

SPatil
SPatil

Reputation: 1003

Well I have had a similar problem.

I have solved it by disabling the scroll view when you receive touch event on its subview.

And when you think your event is complete you re-enable the scroll view.

If you do not do enable-disable the scroll view cancels your drag events automatically!

Upvotes: 1

Related Questions