Reputation: 223
I want to create table view in which paging is required but i want an extra feature like if one cell is added to bottom then one cell will be removed to top
for example
if table have 100 rows and user scroll to bottom app call to server and load another 20 rows at bottom and on same time 20 rows from top will be removed.
if user scroll to top then app call to server and load 20 cell to top and remove 20 cell to bottom.
in short anyhow table have 100 cells only depending on scroll direction cell will be added on top or bottom
Upvotes: 0
Views: 1009
Reputation: 21
What you are looking for is "Infinite Scroll" A Quick Search brought me following results:
Upvotes: 0
Reputation: 1720
You can maintain the offset and limit for your number of results. Based on the previous offset, you can ask for the next set of results to load in the tableview.
And you can hit API to load result in willDisplayCell:forRowAtIndexpath method of UITableView when the indexPath.row is greater than or equal to your number of results while scrolling down and while scrolling up you can check for indexpath.row == 0 to hit the api to produce previous 20 results.
Upvotes: 0
Reputation: 404
To get Extra Feture
It will be updated tableview with new 20 items.
Upvotes: 1