How to detect that UIScrollView is scrolling or that is is dragging
Better use isTracking
to detect if the user initiated a touch-drag.
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.isTracking {
// ...
}
}
Implement these two delegate methods..
- (void)scrollViewDidScroll:(UIScrollView *)sender{
//executes when you scroll the scrollView
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
// execute when you drag the scrollView
}
This answer is deprecated. See @ober's isTracking solution instead
- (void)scrollViewDidScroll:(UIScrollView *)sender{
if(sender.isDragging) {
//is dragging
}
else {
//is just scrolling
}
}