diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index e43490ec..6f6670e2 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -193,9 +193,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N - (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 scrollViewContentHeight = self.scrollView.contentSize.height; + CGFloat scrollOffsetThresholdMax = MAX(scrollViewContentHeight, self.scrollView.bounds.size.height); + CGFloat scrollOffsetThreshold = scrollOffsetThresholdMax-self.scrollView.bounds.size.height; + if(!self.scrollView.isDragging && self.state == SVInfiniteScrollingStateTriggered) self.state = SVInfiniteScrollingStateLoading; else if(contentOffset.y > scrollOffsetThreshold && self.state == SVInfiniteScrollingStateStopped && self.scrollView.isDragging)