I have some options in an UITableView and want that the user can scroll forever. When the end is reached, I want to append the begginning so the user can continue to scroll.
How would I do that?
I have some options in an UITableView and want that the user can scroll forever. When the end is reached, I want to append the begginning so the user can continue to scroll.
How would I do that?
In tableView:numberOfRowsInSection:
return some huge number, and act accordingly in tableView:cellForRowAtIndexPath:
by returning same cells over and over.
You can also have limited number of rows, and at the end show a different cell - containing a button for user which he can use to append new rows. When that button is clicked you simply call [tableView reloadData]
and provide more rows in table's data source.
Aren't you by any chance misusing the table-view for something it doesn't fit that well ? Maybe you would be better off using just a UIScrollView and reposition subviews as user scrolls over.
I think the only problem is how to trick in the method numberOfRows:
. One possible solution is to return some big number here, for example, 10 000
. Then, you set up a correct cellForRowAtIndexPath:
to return based on your data's number modulo. For example, if you have 100 data entity, then you have to get the indexPath.row % 100