UItableViewCell with old content

I had a UITableView that had relatively simple cells. So simple in fact that I didn’t want to bother with subclassing UITableViewCell to draw up content. The cell had two UILabels and one UIImageView.
The problem however derived from reusing the cell – when drawing transparent PNG images into that cell, older data was still present and visible in new cells. This meant that I had to somehow clear the cell from old content.
This is how it can be done. Add the following just before creating new content:

for (UIView *view in cell.contentView.subviews) {
 [view removeFromSuperview];

This clear the contentView from old content and you can start adding new.

image © jeffk42