UIscrollView DidScroll - only when touched

I want to determine when a user scrolls a UIScrollView. scrollViewDidScroll is called when this happens, but it was also called at another time — when the user scrolls the view outside the borders and then releases it, he goes back to it — and this method is called even if the user does not touch the screen at all (viewing scrolls by yourself).

How can I detect scrolling and user contact together?

+5
source share
1 answer

UIScrollView has a property draggingthat indicates whether scrolling has been performed by the user. So, to see that the user is scrolling or scrolling caused by something else (like an animation), you can do the following:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
   if (scrollView.dragging) {
      // scrolling is caused by user
   }
}
+9
source

All Articles