no more scrollViewDidEndScrollingAnimation delegat

2019-06-14 05:49发布

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

1条回答
Melony?
2楼-- · 2019-06-14 06:04

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];
}
查看更多
登录 后发表回答