检测 UIScrollView 何时完成使用委托方法滚动
scrollViewDidEndDecelerating: 这告诉委托滚动视图已经结束减速滚动运动。
目标 C:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self stoppedScrolling];
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
[self stoppedScrolling];
}
}
- (void)stoppedScrolling {
// done, do whatever
}
迅速:
func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if !decelerate {
stoppedScrolling()
}
}
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
stoppedScrolling()
}
func stoppedScrolling() {
// done, do whatever
}