How can I test if the scroll view is bouncing?

Infinite Possibilities picture Infinite Possibilities · May 18, 2010 · Viewed 11.3k times · Source

How can I test if the scroll view is bouncing? Is there a notification or something when the bounce ends?

Answer

Justin Tanner picture Justin Tanner · Jan 26, 2012

Here is how I detected if the scroll view is bouncing horizontally:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

  if (scrollView.contentOffset.x < 0) {
    NSLog(@"bouncing left");
  }

  if (scrollView.contentOffset.x > (scrollView.contentSize.width - scrollView.frame.size.width)) {
    NSLog(@"bouncing right");
  }
}