Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite scrolling no longer triggered inappropriately when the scroll view's content size is taller than its frame's height. #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down