将图像添加到uitableview单元格
问题描述:
我有 tableview
,如何将图片添加到此单元格的左侧?
I have a tableview
, how can I add image to the left of this cells?
答
cell.imageView.image = [UIImage imageNamed:@"image.png"];
更新:
像Steven Fisher说的那样,这应该适用于UITableViewCellStyleDefault样式的单元格是默认样式。对于其他样式,您需要将UIImageView添加到单元格的contentView。
UPDATE: Like Steven Fisher said, this should only work for cells with style UITableViewCellStyleDefault which is the default style. For other styles, you'd need to add a UIImageView to the cell's contentView.