【发布时间】:2011-02-06 17:37:57
【问题描述】:
我想移动一个单元格中包含的 imageView,它可以工作,但在新位置创建一个新图像,保留旧图像(然后显示两个)。我怎么能删除旧的?使用代码:
UIImage *cellImage = [UIImage imageNamed:(@"%@", showIconName)];
UIImageView *imageViewToPutInCell = [[UIImageView alloc] initWithImage:cellImage];
imageViewToPutInCell.frame = CGRectMake(iconPos, 7, cellImage.size.width, cellImage.size.height);
[cell.contentView addSubview:imageViewToPutInCell];
每次我重新加载 tableView 时,它都会创建一个新的重叠图像。
[cell.contentView removeFromSuperview];以前使用过,将其删除,但不会创建新图像。
【问题讨论】:
标签: iphone cocoa-touch uitableview uikit cell