R – no more scrollViewDidEndScrollingAnimation delegate after bounce

iphoneuiscrollview

My UIScrollView has a strange behaviour.
A view controller is a delegate of my UIScroll, during scroll I receive scrollViewDidScroll and scrollViewDidEndScrollingAnimation. All is working.
But when the scroll view bounces, I no more receive scrollViewDidEndScrollingAnimation but still receiving scrollViewDidScroll…

Do you have an idea ?

Thanks a lot.

Thierry

Best Answer

It behaves in a similar way when zooming. I've fixed it in my ZoomScrollView component by setting up a timer. The following should work for you:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_zoomDidEndBouncing) object:nil];
    [self performSelector:@selector(_zoomDidEndBouncing) withObject:nil afterDelay:0.1];
}

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_zoomDidEndBouncing) object:nil];
    [self performSelector:@selector(_zoomDidEndBouncing) withObject:nil afterDelay:0.1];
}