2013-05-28 38 views

回答

1

我假设您将自定义单元添加到表视图的底部以指示当前数据集的结尾。当您创建该单元格时,请将其tag属性设置为您之前定义的有意义的常量,如END_OF_TABLE_CELL

然后使用委托方法tableView:willDisplayCell:forRowAtIndexPath检查要显示的单元格是否是您的自定义单元格,并触发表格数据源的重新加载。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//check your cell's tag 
if (cell.tag == END_OF_TABLE_CELL) { 
     //Call your custom method to fetch more data and reload the table 
    // You should also remove this custom cell from the table and add one at the bottom 
} 
} 

这样,您将有自我刷新每当用户向下滚动到足以使自定义单元格进入视野的表。

祝你好运!

+0

我做了这个,它的工作就像一个魅力。这种方法的更深入的教程:http://nsscreencast.com/episodes/8-automatic-uitableview-paging。 – niaher

相关问题