iPhone UIScrollView Speed Check

NoodleOfDeath picture NoodleOfDeath · Sep 15, 2010 · Viewed 37.8k times · Source

I know how to get the contentOffset on movement for a UIScrollView, can someone explain to me how I can get an actual number that represents the current speed of a UIScrollView while it is tracking, or decelerating?

Answer

karstux picture karstux · Mar 26, 2012

There's an easier way: check the UISCrollview's pan gesture recognizer. With it, you can get the velocity like so:

CGPoint scrollVelocity = [[_scrollView panGestureRecognizer] velocityInView:self];