Search code examples
iosuiscrollviewuiscrollviewdelegate

Detect sudden scroll stop in UIScrollView


I would like to know how to use the UIScrollViewDelegate to detect when the scroll view stops moving suddenly because the user has touched and held the screen after momentum has been initiated from a fast pan.

The scrollViewDidEndDecelerating: method only fires for the above case when the user has lifted their finger. However, if the user taps and holds during scroll view momentum then this method doesn't fire (until they lift their finger). Is there anyways to intercept this when the scroll view stops dead upon the user's touch down?


Solution

  • Well, you could have a flag that is raised when the user starts scrolling, which ends in scrollViewDidEndDecelerating. That way, if the user starts scrolling again before the flag is cleared, you will know that they touched it during a deceleration.