diff --git a/Demo/SVPullToRefreshDemo/SVViewController.m b/Demo/SVPullToRefreshDemo/SVViewController.m index 10c1aaa1..45be0479 100644 --- a/Demo/SVPullToRefreshDemo/SVViewController.m +++ b/Demo/SVPullToRefreshDemo/SVViewController.m @@ -43,7 +43,7 @@ - (void)viewDidAppear:(BOOL)animated { - (void)setupDataSource { self.dataSource = [NSMutableArray array]; - for(int i=0; i<15; i++) + for(int i=0; i<3; i++) [self.dataSource addObject:[NSDate dateWithTimeIntervalSinceNow:-(i*90)]]; } diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index e43490ec..b2ab2203 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -194,7 +194,7 @@ - (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 scrollOffsetThreshold = MAX(scrollViewContentHeight-self.scrollView.bounds.size.height,0); if(!self.scrollView.isDragging && self.state == SVInfiniteScrollingStateTriggered) self.state = SVInfiniteScrollingStateLoading;