, 당신은 블록 밖에서 세포를 생성하고 단지 내부 이미지 설정해야합니다 : 동일한 방법에서`cellForRowAtIndexPath` 부르는 것을 들어
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BSProductCell *cell = [tableView dequeueReusableCellWithIdentifier:BSProductCellIdentifier];
if(cell==nil){
cell = [[BSProductCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:BSProductCellIdentifier];
}
cell.productImageView.image = [UIImage imageNamed:@"Placeholder"];
[[BSImageLoader sharedInstance] getImageWithURL:self.dataSourceArray[indexPath.row] withCompletionBlock:^(UIImage *image, BOOL fromCache, NSString *error){
//Here you check that the cell is still displayed
if([tableView cellForRowAtIndexPath:indexPath]){
[cell.productImageView setImage:image];
NSLog(@"%@", cell);
}
}];
return cell;
}
를? – sage444
내 코드가 잘못되었습니다. – streem
훨씬 좋음 – sage444