0
tableView
가 있습니다. 배열 (cellMap
)에서 데이터를 가져옵니다. viewDidLoad
에 데이터가 배열에 추가됩니다.백그라운드에 이미지를로드하십시오.
CellModel *model = self.cellMap[indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:configurator.identifier forIndexPath:indexPath];
cell.title = model.title;
cell.price = model.price;
cell.image = model.image;
return cell;
방법 화상 부하에 대한 백그라운드에서 : 데이터가 어레이로부터 촬영 cellForRowAtIndexPath
방법에
[self.cellMap addObject:[CellModel initWithTitle:title
price:price
image:getProductImageByImgURL:url
];
- (UIImage *)getProductImageByImgURL:(NSString *)url {
__weak typeof(self)weakSelf = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
__strong typeof(self)strongSelf = weakSelf;
strongSelf.productImage = [UIImage loadImage:url];
});
return self.productImage;
}
어디 self.productImage
@property (strong, nonatomic) UIImage *productImage;
결과 - 모든 셀에는 마지막으로로드 된 이미지가 있습니다. 문제가 무엇입니까?
Not working .. 8 ( – Gikas