刷新代码IOS 上拉分页刷新--
PS:今天上午,非常郁闷,有很多简单基础的问题搞得我有些迷茫,哎,代码几天不写就忘。目前又不当COO,还是得用心记代码哦!
//放到每次刷新中(分程线和下拉刷新公用) 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];
}
文章结束给大家分享下程序员的一些笑话语录: 腾讯总舵主马化腾,有人曾经戏称如果在Z国选举总统,马化腾一定当选,因为只要QQ来一个弹窗”投马总,送Q币”即可。

浙公网安备 33010602011771号