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

scrollOffsetThreshold needs consider originalBottomInset? #300

Open
sou1x0 opened this issue Jul 27, 2017 · 0 comments
Open

scrollOffsetThreshold needs consider originalBottomInset? #300

sou1x0 opened this issue Jul 27, 2017 · 0 comments

Comments

@sou1x0
Copy link

sou1x0 commented Jul 27, 2017

- (void)scrollViewDidScroll:(CGPoint)contentOffset {
    if(self.state != SVInfiniteScrollingStateLoading && self.enabled) {
        CGFloat scrollViewContentHeight = self.scrollView.contentSize.height;
        CGFloat scrollOffsetThreshold = scrollViewContentHeight-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)
            self.state = SVInfiniteScrollingStateTriggered;
        else if(contentOffset.y < scrollOffsetThreshold  && self.state != SVInfiniteScrollingStateStopped)
            self.state = SVInfiniteScrollingStateStopped;
    }
}

scrollOffsetThreshold should consider originalBottomInset. So I think scrollOffsetThreshold += self.originalBottomInset; should be inserted after CGFloat scrollOffsetThreshold = scrollViewContentHeight-self.scrollView.bounds.size.height;

Otherwise, when scrollview has bottom inset, supposed it's a positive number, and it currently reaches to the end, state will still be loading even though user scrolls up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant