HyLian
HyLian

Reputation: 5093

Prevent UIScrollView from stopping the scroll when a touch happen

The question is a little bit weird, but that's what I need ;)

Usually, when a UIScrollView is scrolling, if you touch the view, it stops immediately, but that's the behavior I want to change.

I've subclassed UITableView and overriden the touches* method, but while the table is scrolling no touches* events are called. As I've read in the Apple Documentation, UIScrollView (which is the parent class of UITableView) doesn't forward those events.

What I want is to detect that touch (which will stop the scroll in a ordinary scenario) but keep the UIScrollView scrolling.

So, instead stopping the scroll I want to have a method which is going to be called.

Upvotes: 2

Views: 1301

Answers (1)

Wilbur Vandrsmith
Wilbur Vandrsmith

Reputation: 5050

When scrollViewDidEndDragging:willDecelerate:, add a transparent view above the table view with userInteractionEnabled that intercepts touches. Then on scrollViewDidEndDecelerating:, remove it to restore normal interaction with the table view. Wire up touch handlers on the overlay to get callbacks.

Upvotes: 7

Related Questions