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

Support for prepending items on pull to refresh #70

Open
anqqa opened this issue Oct 27, 2012 · 4 comments
Open

Support for prepending items on pull to refresh #70

anqqa opened this issue Oct 27, 2012 · 4 comments

Comments

@anqqa
Copy link

anqqa commented Oct 27, 2012

I'm using SVPullToRefresh in my calendar application to load previous events when scrolling upwards and infinite scroll to load next events.

With previous version I managed to make it work so that after reloading the TableView with new data prepended I scrolled to the previously first item and called stopAnimating and it worked like a charm, the last of the now prepended items replaced the loader and I could continue scrolling upwards.

With current version if I do the same it always scrolls to the first item in the table. Changing the execution order to stopAnimating before TableView's reloadData and scroll there's short flickering as the table scrolls to empty first item, reloads and then back to the previously first item.

Any ideas how to make it smooth again? Diff for the change between old and new SVPullToRefresh at anqqa/klubitus-ios@680f5d0

@samvermette
Copy link
Owner

I would need a demo project that demonstrates this issue so I can see what might be the problem.

Have you tried disabling animations within SVPullToRefresh on the stopAnimating method see if that fixes it? Also, is there any reasons why you're not using UITableView's insertRows method instead of calling reloadData?

@exalted
Copy link

exalted commented Oct 31, 2012

@samvermette It is not that I am going to argue about reloadData is better than table view's insert mechanism, but usually it is way easier to update the data source and then simply reloadData instead updating the view manually. (I have no idea about @anqqa's specific issue though)

@anqqa
Copy link
Author

anqqa commented Oct 31, 2012

Haven't tried to disable animations from stopAnimating, will try that next, thanks.

And the reason for realoadData vs insertRows is just my lack of competence as this was my first iPhone app, so still going with anything I can manage to get to work reasonably well :D

@samvermette
Copy link
Owner

@exalted I was asking out of curiosity, but you're right that the class should be able to work fine with reloadData as well.

@anqqa let me know the results you get!

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

3 participants