本文介绍了反弹后不再有 scrollViewDidEndScrollingAnimation 委托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 UIScrollView 有一个奇怪的行为.视图控制器是我的 UIScroll 的委托,在滚动期间我收到 scrollViewDidScroll 和 scrollViewDidEndScrollingAnimation.一切都在工作.但是当滚动视图反弹时,我不再收到 scrollViewDidEndScrollingAnimation 但仍然收到 scrollViewDidScroll...

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...

你有什么想法吗?

非常感谢.

蒂埃里

推荐答案

缩放时的行为方式类似.我已经通过设置计时器在我的 ZoomScrollView 组件中修复了它.以下应该对您有用:

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

这篇关于反弹后不再有 scrollViewDidEndScrollingAnimation 委托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 09:20