thierryb
thierryb

Reputation: 3728

no more scrollViewDidEndScrollingAnimation delegate after bounce

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

Upvotes: 0

Views: 2116

Answers (1)

Andrey Tarantsov
Andrey Tarantsov

Reputation: 9073

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];
}

Upvotes: 1

Related Questions