当我的UIScrollView滚动或拖动时,我需要持续了解。
答案 0 :(得分:26)
实现这两个委托方法..
- (void)scrollViewDidScroll:(UIScrollView *)sender{
//executes when you scroll the scrollView
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
// execute when you drag the scrollView
}
答案 1 :(得分:12)
更好地使用isTracking
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.isTracking {
// ...
}
}
答案 2 :(得分:6)
@ Shorhashi解决方案的替代方案:
- (void)scrollViewDidScroll:(UIScrollView *)sender{
if(sender.isDragging) {
//is dragging
}
else {
//is just scrolling
}
}