IOS 上拉分页刷新--
来源:互联网 发布:剑三成女捏脸数据 云盘 编辑:程序博客网 时间:2024/06/07 02:09
//放到每次刷新中(分线程和下拉刷新公用)iListCountNum=1;isEndList=NO;
///////////////详细代码如下--
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ //NSLog(@"%d",m_tieziList.count); NSLog(@"%d",indexPath.row); if(indexPath.row==(m_tieziList.count-1)&&isEndList==NO) { iListCountNum++; NSLog(@"%d",indexPath.row); NSThread *InitThread = [[NSThread alloc]initWithTarget:self selector:@selector(GetNewListThread:) object:tableView]; [InitThread start]; }}-(void)GetNewListThread:(id)sender{ NSMutableArray *array =[g_data GetTieziList:m_forumNode->forum_id pageSize:9 pageNum:iListCountNum]; if(array.count == 0) { isEndList = YES; } else { isEndList=NO; } [m_tieziList addObjectsFromArray:array]; [self performSelectorOnMainThread:@selector(ReLoadTableData:) withObject:(UITableView*)sender waitUntilDone:NO];}-(void)ReLoadTableData:(id)sender{ UITableView *table = (UITableView*)sender; [table reloadData]; }