36

I have implemented the UIScrollViewDelegate protocol in my .h file and i have implemented the

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

method in my .m class. when the scrolling is done in my table view other delegate method of scrollview are getting called, but when scrolling ends, -scrollViewDidEndScrollingAnimation: is not getting called. I am bit stuck in this.

Thanks and regards

leppie
  • 115,091
  • 17
  • 196
  • 297
Gani
  • 709
  • 3
  • 13
  • 21

5 Answers5

112

-scrollViewDidEndScrollingAnimation: is called when a programmatic-generated scroll finishes.
-scrollViewDidEndDecelerating: is called when a user-swipe scroll finishes.

e.James
  • 116,942
  • 41
  • 177
  • 214
Bogatyr
  • 19,255
  • 7
  • 59
  • 72
  • 3
    +1 and thank you for explaining the difference between the two delegate methods. I think this should be the accepted answer! – e.James Feb 08 '11 at 06:42
  • 6
    And if you also want to react on when a user drags the scroll view, but releases it without the scroll view scrolling further, you should also implement the ``scrollViewDidEndDragging`` method, you can check the bool parameter ``willDecelerate`` to decide on whether you have to execute the code here or in the ``scrollViewDidEndDecelerating`` method. – TheEye Dec 10 '13 at 15:03
2

I had the same problem ... Try using scrollViewDidEndDecelerating instead.

yujean
  • 795
  • 8
  • 14
2

Had the same problem. Have used the following in my delegate class:

#pragma mark -
#pragma mark UIScrollViewDelegate
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {

    NSLog(@"lol");
}

works like a charm!

valvoline
  • 7,737
  • 3
  • 47
  • 52
  • Thanks big help. Have you filed a bug report about this? I've just submitted rdar://8810881 http://openradar.appspot.com/8810881. – theory Dec 31 '10 at 01:45
1

I had the same problem and the issue was i did not include the delegate code:

self.myScrollView.delegate=self;

Hope this helps someone as well.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
Deeps
  • 91
  • 1
  • 6
0

Swift?

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {

}
Hemang
  • 26,840
  • 19
  • 119
  • 186