iPhone UITableView分页结果

War*_*ard 2 iphone pagination uitableview

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

谢谢,豪伊

Lia*_*iam 5

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

在里面 ...

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
Run Code Online (Sandbox Code Playgroud)

如果还有更多要检索的内容,请添加1行

  return totalCount > [list count]?[list count]+1:[list count]
Run Code Online (Sandbox Code Playgroud)

然后是...的最后一个单元格

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Run Code Online (Sandbox Code Playgroud)

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

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

然后在......

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Run Code Online (Sandbox Code Playgroud)

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