您的位置:首页 > 产品设计 > UI/UE

关于UITableView中的 TableFooterView的使用介绍

2015-07-28 11:32 288 查看
用UITableViewDelegate中的这个方法:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;

判定tableView中的数组数是否即将显示最后一个cell,if (indexPath.row == [self.dataArr count]-1)

如果是的话,self.tableView.tableFooterView = footSpinnerView;//footSpinnerView为自定义的UIView,上面加了一个旋转的UIActivityIndicatorView即可,记得让UIActivityIndicatorView startAnimation

加上你关于刷新数组的逻辑,如从数据库中取出更多的数据,取完数据后,将self.tableView.tableFooterView设nil即可。

#pragma mark -

#pragma mark UITableViewDelegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

if (indexPath.row == [self.productArr count]-1) {

[self setupFootSpinnerView];

self.tableView.tableFooterView = footSpinnerView;

if (currentArrCount < dataCount) {

currentArrCount += 5;

self.dataArr = [dao getArrayOfDataLimit:currentArrCount offset:0];//从数据库中重新取数据

[self.tableView reloadData];

}else{

self.tableView.tableFooterView = nil;

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: