这篇文章在我的TableView中给出了奇怪的结果。我希望为重复的对象值为“标记”=“是”的单元格显示UIImage
。
这是什么代码?
if ([[[sortedObjects objectAtIndex: indexPath.row] valueForKey:@"Marked"] isEqual:@"Yes"])
{
cell.markedImageView.image = [UIImage imageNamed:@"markedItem.png"];
}
答案 0 :(得分:1)
问题是每次重复使用单元格时都需要清除imageView图像。
- (void)configCell:(MyCustomCell *)cell atIndexPath:(NSIndexPath)indexPath
{
cell.markedImageView.image = nil;
// configure cell normally
if ([[[sortedObjects objectAtIndex: indexPath.row] valueForKey:@"Marked"] isEqual:@"Yes"])
{
cell.markedImageView.image = [UIImage imageNamed:@"markedItem.png"];
}
}