UITableView中的tableFooterView实现新浪微博下拉无限添加 没有人用过tableFooterView吗?或者这样的功能(tableView移动到最后一行会添加刷新数据,就是新浪微博那个效果)有没有其他方法可以实现?求高手!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是这样实现的:首先,UITableView 的父视图是 UIScrollView。然后,在 FooterView 中添加一个 UIView,并记住 offset(在 UIScrollView 中的),当滑动点超过这个 offset 时,去服务器取数据,添加到数据源中。 用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即可。Demo:#pragma -#pragma 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; } }} 如何在windows下获取iPhone充电电量? 关于IPHONE开发完毕后发布的问题 有没有高手来帮我解决一下 求教可在iphone运行的jquery mobile小程序,论坛分+RMB感谢 讨论iPhone、iPad App的开发成本 xcode快捷问题 各位大神教下 不需要2分钟时间 谢谢。 如何判断两个View的background是否相等 UIButton 的 setImage 方法 ios 微信分享 如何同时分享多张图片 询问下twitter分享相关的疑问 在iphone中web应用开发如何上传本地文件 UIViewController + uiScrollView控件
首先,UITableView 的父视图是 UIScrollView。
然后,在 FooterView 中添加一个 UIView,
并记住 offset(在 UIScrollView 中的),
当滑动点超过这个 offset 时,
去服务器取数据,
添加到数据源中。
- (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即可。
Demo:#pragma -
#pragma 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;
}
}}