일반적으로 Cell은 Cell nil 조건을 벗어나서 구성됩니다. 제 경우에는 NSData를 Cell nil 외부의 이미지로 변환하는 것과 동일한 작업을 수행하고 있습니다. 그래서, 내가 요청과 테이블을 다시로드 할 때마다, 그것은 특정 셀의 이미지로 데이터를 완벽하게 변환 할 것입니다. 하지만 테이블을 다시로드 한 후 내 문제는 내가 테이블을 스크롤 할 때마다 명백한 이미지로 NSData를 변환합니다. 테이블을 다시로드 한 후 스크롤 할 때이 변환을 피할 필요가 있습니다.UITableViewCell 없음 조건
static NSString *CellIdentifierImage = @"CellIdentifierImage";
if(indexPath.section == 0)
{
NewsImageCell *newsImageCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImage];
if (newsImageCell == nil)
{
NSLog(@"CellNil");
newsImageCell = [[NewsImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierImage];
newsImageCell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if([[ApplicationData sharedInstance].arrTop10NewsHome count]>0)
{
NSMutableDictionary *dicSource = [arrSource objectAtIndex:indexPath.row];
NSURL *urlImage = [NSURL URLWithString:[dicSource retrieveForPath:@"ItemImage"]];
newsImageCell.lblNewsHeading.text = [dicSource objectForKey:@"Title"];
[newsImageCell.loadingIndicator startAnimating];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:urlImage]];
dispatch_sync(dispatch_get_main_queue(), ^{
newsImageCell.imgVwNews.image = image;
[newsImageCell.loadingIndicator stopAnimating];
});
});
}
return newsImageCell;
}
감사합니다. 감사합니다.