Reputation: 2639
I need to know on a continuous basis when my UIScrollView is scrolling or dragging.
Upvotes: 17
Views: 25798
Reputation: 830
This answer is deprecated. See @ober's isTracking solution instead
- (void)scrollViewDidScroll:(UIScrollView *)sender{
if(sender.isDragging) {
//is dragging
}
else {
//is just scrolling
}
}
Upvotes: 7
Reputation: 2481
Better use isTracking
to detect if the user initiated a touch-drag.
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.isTracking {
// ...
}
}
Upvotes: 22
Reputation: 670
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
}
Upvotes: 27