标签:
1.通过为每个cell指定不同的重用标识符(reuseIdentifier)来解决
// static NSString *rankCellIndefier = @"rankCell";
NSString *cellMark = [NSString stringWithFormat:@"%ld", indexPath.row];
NewsCustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellMark];
tableView.rowHeight = 80;
if (cell == nil) {
cell = [[[NewsCustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellMark] autorelease];
if (indexPath.row < 3) {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
imageView.tag = 100 + indexPath.row;
[cell addSubview:imageView];
[imageView release];
}
}
if (indexPath.row < 3) {
UIImageView *imageView = (UIImageView *)[cell viewWithTag:100 + indexPath.row];
imageView.image = [UIImage imageNamed:rankingArray[indexPath.row]];
}
cell.titleLabel.text = news.headLineTitle;
[cell resetLabelFrame:news.headLineTitle];
cell.dateLabel.text = news.headLineDate;
cell.rightCountLabel.text = news.headLineCount;
[pictureAsy pictureCustom:cell imageUrl:news.headLinePhoto indexImage:0];
return cell;
}
删除重用cell的所有子视图
这个方法是通过删除重用的cell的所有子视图,从而得到一个没有特殊格式的cell,供其他cell重用。
标签:
原文地址:http://www.cnblogs.com/tian-sun/p/4220533.html