I want to detect when user is scrolling a UIScrollView. scrollViewDidScroll is called when that happens, but it's called also in another time - when the user scrolls the view out of bounds, and then releases, the view jump back to it's place - and the method is called even though the user doesn't touch the screen at all (the view is scrolled by itself).
how can I detect scrolling and user touch together?
UIScrollView has a property dragging
that indicates whether the scrolling was done by the user. So to see whether the user scrolls the scrollview or the scrolling is caused by something other (like an animation) you can do the following:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.dragging) {
// scrolling is caused by user
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With