开发者

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 开发者_JAVA百科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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜