关于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;
}
}
}
- (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;
}
}
}
相关文章推荐
- JavaSE实战——GUI简述、用户登录注册最终版、模拟微信打飞机游戏实例
- HTML textarea的value 问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- 自己动手实现一个队列LGQueue(刚刚)
- android 推送 mosquitto MQTT
- UIView之动画效果的实现方法(合集
- django @login_required
- 采用easyui tree编写简单角色权限代码的方法
- iOS-UI-02 UILabel UIButton
- ioS -UI-菜单栏的实现
- fifa 15 xbox one coins live quite feints
- PAT (Advanced Level) 1062. Talent and Virtue (25) 德才论,结构体排序
- [Jenkins] 执行SoapUI的task,设置邮件内容为HTML+CSS
- leetCode 96.Unique Binary Search Trees (唯一二叉搜索树) 解题思路和方法
- hdu 2734(Quicksum)
- iPad开发 - UIPopoverController控制器
- Android Studio finished with non-zero exit value 1
- ios 使用xib时,在UIScrollView中添建内容view时,使用约束的注意
- hdu 杭电1509 Windows Message Queue【优先队列】
- 高逼格UI-ASD(Android Support Design)