Reputation: 1141
In my app I have a scroll view that the user can use pull to refresh to update using a custom implementation of pull to refresh based on EGORefreshTableHeaderView. It works perfectly without pagination but with pagination on for reasons that are understandable it the scroll view bounces back to the page and will not stay locked on the pull to refresh because it's so small it doesn't register as a page that one can scroll too.
Is there a way that I can fix this in a way that feels and looks intuitive?
Upvotes: 2
Views: 823
Reputation: 3311
Had the same problem today and found a solution :
The reason is that the contentOffset doesn't match your pagination because the size of the loading view is not the same as your page size so the scrollview function detect that and scroll to the current page.
For me the best thing to do is disabling the pagination when the pulltorefresh is triggered (before function using contentOffset of your scrollview) and restoring it after refresh if pagination was enabled on your scrollview
Here is an example of what i changed on the lib i use
switch (newState) {
case SVPullToRefreshStateAll:
case SVPullToRefreshStateStopped:
[self resetScrollViewContentInset];
if (self.isPaginationEnabled) {
self.scrollView.pagingEnabled = YES;
}
break;
case SVPullToRefreshStateTriggered:
if (self.scrollView.pagingEnabled) {
self.isPaginationEnabled = YES;
self.scrollView.pagingEnabled = NO;
}
break;
case SVPullToRefreshStateLoading:
[self setScrollViewContentInsetForLoading];
if(previousState == SVPullToRefreshStateTriggered && pullToRefreshActionHandler)
pullToRefreshActionHandler();
break;
}
Upvotes: 1