Paginate results for iPhone UITableView
What's the best way for us to paginate a large number of results that are pulled out of gray? As far as the server is concerned, I can compensate and limit the results, so I only pulled, perhaps 25 at a time, but what is the best way to let the user view more results without constantly scrolling through a growing list like an app store?
thanks howie
+2
a source to share
1 answer
To add a new cell at the bottom of the list that will receive the next set when you click on it, do the following
AT...
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
Add 1 extra line if there is more to get
return totalCount > [list count]?[list count]+1:[list count]
Then for the last cell in ...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
create a "Load more" cell if required
[[NSBundle mainBundle] loadNibNamed:@"LoadMoreCell" owner:self options:nil];
LoadMoreCell *cell = loadMoreCell;
NSString *loadMore = [NSString string with Format:@"Load %d more...", numberToLoad];
Then in...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
do what it takes to update the list of items in the table view with the new sum
+5
a source to share