-(void)fetchData
{
//初始化一个子线程
NSOperationQueue *queueOne=[[NSOperationQueuealloc]init];
[queueOne addOperationWithBlock:^{
}];
//在主队列更新UI
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
__weak typeof(self) weak_self = self;
NSString *page=[NSStringstringWithFormat:@"%d",self.pageOfSay];
//获取token
NSUserDefaults *user=[NSUserDefaultsstandardUserDefaults];
NSString *token=[user objectForKey:@"token"];
//调用方法获取说说数据
[self.manager requestGetStatuswithToken:tokenPage:page Complention:^(NSString *code, NSString *result,NSString *error, NSString *totolPages, NSArray *arr) {
weak_self.maxPages=totolPages.intValue;
[weak_self.data addObjectsFromArray:arr];
NSLog(@"weak_self.marr addObject:status=%@",weak_self.data);
if ([result isEqualToString:@"1"])
{
SHOW_TEXT(error);
return ;
}
if ([totolPages isEqualToString:@"0"]) {
[weak_self.tableViewOfSay.headerendRefreshing];
}
[weak_self.tableViewOfSay reloadData];
//设置刷新完毕后,关闭refresh
[weak_self.tableViewOfSay.header endRefreshing];
[weak_self.tableViewOfSay.footer endRefreshing];
}];
}];
}
新闻热点
疑难解答