我在 tableview 中遇到问题,我正在设置 uitableviewcell 的背景,但是当我滚动 tableview 时,背景图像与单元格的图像和文本重叠。我不知道原因。这是代码。请帮助我。谢谢。
NSString *CellIdentifier = [NSString stringWithFormat:@"%d",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIImage *image = [UIImage imageNamed:@"Workout strip.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.backgroundColor = [UIColor clearColor];
imageView.opaque = NO;
imageView.contentMode = UIViewContentModeBottomLeft;
cell.backgroundView = imageView;
cell.backgroundView.tag = indexPath.row;
[imageView release];
cell.textLabel.text = [exerciseNames objectAtIndex:indexPath.row];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.imageView.image = [UIImage imageNamed:@"Workout video box.png"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;