/* 异步执行计算操作*/
dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (NSString * imageStr in self->_imgArray) {
CGSize sizee = [UIImage getImageSizeWithURL:[NSURL URLWithString:imageStr]];
NSString *cellH = [NSString stringWithFormat:@"%f",ScreenW/(sizee.width/sizee.height)];
[self->_cellHArr addObject:cellH];
}
/* 计算完成后再主线程中回调数据,因为一般拉倒值后会直接设置UI控件属性。 */
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
});
网友评论