UITableView实现上拉加载更多
来源:互联网 发布:飞鸽传书需要网络吗 编辑:程序博客网 时间:2024/05/29 06:32
//创建表格底部
- (void) createTableFooter
{
myTableView.tableFooterView= nil;
UIView *tableFooterView = [[UIViewalloc]initWithFrame:CGRectMake(0.0f,0.0f,myTableView.bounds.size.width,40.0f)];
UILabel *loadMoreText = [[UILabelalloc]initWithFrame:CGRectMake(0.0f,0.0f,116.0f,40.0f)];
[loadMoreText setCenter:tableFooterView.center];
[loadMoreText setFont:[UIFontfontWithName:@"Helvetica Neue"size:14]];
[loadMoreText setText:@"上拉显示更多数据"];
[tableFooterView addSubview:loadMoreText];
myTableView.tableFooterView= tableFooterView;
}
- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView willDecelerate:(BOOL)decelerate
{
// 下拉到最底部时显示更多数据
if(!_loadingMore&& scrollView.contentOffset.y> ((scrollView.contentSize.height- scrollView.frame.size.height)))
{
NSLog(@"开始加载");
[selfloadDataBegin];
}
if(!_loadingMore&& scrollView.contentOffset.y> ((scrollView.contentSize.height- scrollView.frame.size.height)))
{
NSLog(@"开始加载");
[selfloadDataBegin];
}
}
//开始加载数据
- (void) loadDataBegin
{
if (_loadingMore== NO)
{
_loadingMore = YES;
UIActivityIndicatorView *tableFooterActivityIndicator = [[UIActivityIndicatorViewalloc]initWithFrame:CGRectMake(75.0f,10.0f,20.0f,20.0f)];
[tableFooterActivityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[tableFooterActivityIndicator startAnimating];
[searchTableView.tableFooterViewaddSubview:tableFooterActivityIndicator];
NSLog(@"正在加载");
[selfloadDataing];
}
{
if (_loadingMore== NO)
{
_loadingMore = YES;
UIActivityIndicatorView *tableFooterActivityIndicator = [[UIActivityIndicatorViewalloc]initWithFrame:CGRectMake(75.0f,10.0f,20.0f,20.0f)];
[tableFooterActivityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[tableFooterActivityIndicator startAnimating];
[searchTableView.tableFooterViewaddSubview:tableFooterActivityIndicator];
NSLog(@"正在加载");
[selfloadDataing];
}
}
//加载数据中
- (void) loadDataing
{
/**
*要处理的事件
*/
[selfloadDataEnd];
}
//加载数据完毕
- (void) loadDataEnd
{
NSLog(@"加载完毕");
_loadingMore = NO;
[selfcreateTableFooter];
}
NSLog(@"加载完毕");
_loadingMore = NO;
[selfcreateTableFooter];
}
0 0
- UITableView实现上拉加载更多
- UIScrollerView和UITableView下拉刷新,上拉加载更多
- UITableView:下拉刷新和上拉加载更多
- ListView实现上拉加载更多
- android-----ListView上拉加载更多实现
- 实现上拉加载更多的SwipeRefreshLayout
- 实现上拉加载更多的SwipeRefreshLayout
- 上拉加载更多之ListView实现
- H5页面实现上拉加载更多
- RecyclerView实现上拉加载更多
- React-实现上拉加载更多
- 上拉加载更多
- 上拉加载更多
- 上拉加载更多
- 上拉加载更多
- android 移动开发 实现上拉加载更多实现方式
- listview 上拉加载更多
- ListView上拉加载更多
- 椭圆拟合
- 从脸部识别到火星机器人,正在改变世界的计算机视觉
- Hibernate框架详解(一)总结介绍
- Axis2在Web项目中整合Spring
- YTU 1004: 1、2、3、4、5...
- UITableView实现上拉加载更多
- SSO单点登录学习总结(2)——基于Cookie+fliter单点登录实例
- 标准库类型string
- 打开适配器并捕获数据包
- spring官网
- world break
- 解决XCode7.1 上无法安装 Alcatraz PackageManager
- maven 插件_2 Maven Resources Plugin
- 20.12. smtplib — SMTP protocol client(SMTP 协议 客户端)