iPhone UITableView 分页结果

标签 iphone uitableview pagination

对从服务器中提取的大量结果进行分页的最佳方法是什么?就服务器而言,我可以抵消和限制结果,因此我一次只能提取 25 个结果,但是允许用户查看更多结果而不需要像应用商店一样不断向下滚动不断增长的列表的最佳方式是什么应用程序?

谢谢, 豪伊

最佳答案

要在列表底部添加一个新单元格,单击它时将获得下一组单元格,请执行以下操作

在...

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

如果有更多内容需要检索,则添加 1 行额外的行

  return totalCount > [list count]?[list count]+1:[list count]

然后对于...的最后一个单元格

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

如果需要,创建“加载更多”单元格

[[NSBundle mainBundle] loadNibNamed:@"LoadMoreCell" owner:self options:nil];
LoadMoreCell *cell = loadMoreCell;
NSString *loadMore = [NSString string with Format:@"Load %d more...", numberToLoad];

然后在...

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

执行所需操作以使用新金额更新表格 View 中的项目列表

关于iPhone UITableView 分页结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2690936/

相关文章:

iphone - .NIB -> .XIB 怎么了?

ios - 暂时禁用 UITableView 中的删除按钮

ios - 设置自定义 UITableView tableHeaderView

wpf - 如何在 WPF 中打印带有分页的视觉对象?

pagination - SQLAlchemy 并通过一个大的结果集

iphone - NSMutableArray 和 NSUserdefaults 问题 iPhone

ios - 如何保存来 self 的服务器的响应,以及我如何访问该数据

iphone - 为 iphone 5 屏幕调整 UITableview 的大小

jquery - 缩短easypagination页面显示长度

iPhone UItableview didselectrowAtIndexPath 总是返回选择的第一行