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

Pull to Refresh activates Infinite Scrolling #119

Open
sabernar opened this issue Apr 3, 2013 · 10 comments · May be fixed by #157
Open

Pull to Refresh activates Infinite Scrolling #119

sabernar opened this issue Apr 3, 2013 · 10 comments · May be fixed by #157

Comments

@sabernar
Copy link

sabernar commented Apr 3, 2013

My set up is very simple:

__weak MyClass *weakSelf = self;
[self.tableView addPullToRefreshWithActionHandler:^{
    [weakSelf refreshPollData];
}];

[self.tableView addInfiniteScrollingWithActionHandler:^{
    [weakSelf loadMorePollData];
}];

Infinite Scrolling gets called even though only Pull to Refresh should be called. Could this be because I don't have many rows in my table?

@samvermette
Copy link
Owner

Hmm yeah that could be. I thought this was fixed a while ago, I'll try to give it another look soon.

@Tony091250147
Copy link

Yes, I encountered the same problem when number of cell in a tableview, say 1, is small.

@yimingtang
Copy link
Contributor

Issue #96

@samvermette
Copy link
Owner

The fix: showsInfiniteScrolling should initially be set to NO if the scroll view's content height is lesser than its frame. If anyone wants to jump ahead and make a pull request for this, would be much appreciated.

@anhuijhy
Copy link

anhuijhy commented Dec 3, 2013

all
if we set showsInfinitsScrolling to NO but if we want drag to load more data how handle to visible the infinite view?

@libinliu2013
Copy link

my solution:
1、when view did appear: add pull and infinities action handler and trigger refresh action.
2、after pull refresh callback , invite: [self.tableView showsInfiniteScrolling];
3、change the showsInfiniteScrolling method as follow:
// return !self.infiniteScrollingView.hidden;
return self.showsInfiniteScrolling = self.contentSize.height < self.frame.size.height ? NO : YES;

@nwhittaker
Copy link

+1. @anhuijhy brings up a good point. Sometimes the initial list may be small. e.g. "Get all the results since yesterday" has no guaranteed length -- but we'd still want the infinite scroll enabled if we wanted each "up swipe" to load the previous day's results.

Any way to differentiate between the two swipe types (up vs. down) if the view is shorter than the frame?

@siliconprime-duc
Copy link

Check if the scrollView.contentOffset.y greater than 0 before changing state work for me.
In UIScrollView+SVInfiniteScrolling.m:

  • (void)scrollViewDidScroll:(CGPoint)contentOffset {
    if(self.scrollView.contentOffset.y > 0 && self.state != SVInfiniteScrollingStateLoading && self.enabled) {
    ...
    }

@esttorhe
Copy link

PR #245 has @siliconprime-duc 's fix in case this project is still alive 🙇

@esttorhe
Copy link

I think #260 fixes this.

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