From fdcae074d15c80b2cc62f1df5f8c3c871035c1cb Mon Sep 17 00:00:00 2001 From: Karthik Mitta Date: Sun, 4 Oct 2015 23:04:27 +0530 Subject: [PATCH] Fixed infinite scrolling activate pull to refresh issue --- SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;