在需要上拉加载更多的tableview上设置footerview提示上拉加载更多,
在tableview滑动停止时回调以下方法,在回调时判断tableview及设置加载更多的网络请求操作。
注意:此处所写方法适用于多个tableview的判断。
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
//判断tableview的位置
BOOL table = self.lastTableView.contentOffset.y > self.lastTableView.contentSize.height - self.lastTableView.frame.size.height - 2;
//判断更多按钮标题
BOOL moreButton = ![moreBtn.titleLabel.text isEqualToString:@"加载中..."];
if (table && !loadMoreView.hidden && moreButton && self.lastTableView.tableFooterView)
{
if([StaticTools checkNetWork] == 0)
{
[super internetConnectFailed:0];
return;
}
[moreBtn setTitle:@"加载中..." forState:UIControlStateNormal];
moreActivityIV.hidden = NO;
[moreActivityIV startAnimating];
//加载更多资讯列表
if (self.lastTableView.tag == Tag_Daily)
{
[self getDailyCommentsListWithPageNo:self.pageMtbDict[currentIdStr]];
}
else if (self.lastTableView.tag == Tag_VideoHSZJ)
{
[self getVideoList];
}
else if (self.lastTableView.tag == Tag_Live)//直播
{
[self getVideoListWithFirst:NO];
}
else
{
[self getInformationListWith:currentIdStr pageNo:self.pageMtbDict[currentIdStr]];
}
}
}
网友评论