Reputation: 27133
I have backend that return data based on the parameters. So the parameters include offset and limit keys.
It is something like pagination if you know. So based on the offset and limit server return to me appropriate amount of item from the data base.
At first run, I load 30 items from the 0 offset position. Then I need to load more items after I scrolled down my table and update datasource.
I have found the solution but the problem will be as well not to duplicate data when I will scroll up and then one more scroll down. Maybe there is already made solution or example. Of course I can write some my "wheel", but maybe some one can suggest best algorithm, maybe also using scroll view delegate it is not so good, instead of this maybe better use cellForRowAtIndexPath to determine for example some cell that near to the end of the cells and then update it.
Upvotes: 0
Views: 892
Reputation: 12832
I've solved this same problem with using willDisplayCell
and the following two conditions that control whether more items are loaded:
UITableView
Basically, it's a slight modification of this answer: https://stackoverflow.com/a/19448220/209867
Upvotes: 2