网络解析中,同步解析数据,用子线程去做请求,主线程刷新页面,子线程不能做刷新页面
dispatch_async(dispatch_get_global_queue(0, 0), ^{
#pragma mark 头像
[self.btnHead addTarget:self action:@selector(clickBtnHead) forControlEvents:UIControlEventTouchUpInside];
NSString *strImage = self.dicInfo[@"userImage"];
NSURL *url1 = [NSURL URLWithString:strImage];
NSData *data1 = [NSData dataWithContentsOfURL:url1];
dispatch_async(dispatch_get_main_queue(), ^{
[self.table reloadData];
[self.btnHead setImage:[UIImage imageWithData:data1] forState:UIControlStateNormal];
self.btnHead.layer.cornerRadius = 35;
self.btnHead.clipsToBounds = YES;
});
});