diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index e43490ec..e3ca772a 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -195,10 +195,11 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { if(self.state != SVInfiniteScrollingStateLoading && self.enabled) { CGFloat scrollViewContentHeight = self.scrollView.contentSize.height; CGFloat scrollOffsetThreshold = scrollViewContentHeight-self.scrollView.bounds.size.height; + CGFloat yVelocity = [self.scrollView.panGestureRecognizer velocityInView:self.scrollView].y; if(!self.scrollView.isDragging && self.state == SVInfiniteScrollingStateTriggered) self.state = SVInfiniteScrollingStateLoading; - else if(contentOffset.y > scrollOffsetThreshold && self.state == SVInfiniteScrollingStateStopped && self.scrollView.isDragging) + else if(yVelocity < 0 && contentOffset.y > scrollOffsetThreshold && self.state == SVInfiniteScrollingStateStopped && self.scrollView.isDragging) self.state = SVInfiniteScrollingStateTriggered; else if(contentOffset.y < scrollOffsetThreshold && self.state != SVInfiniteScrollingStateStopped) self.state = SVInfiniteScrollingStateStopped;