Custom table cell background image

kristy4life picture kristy4life · Mar 15, 2011 · Viewed 8.3k times · Source

I'm taking my first stab at the three20 iPhone framework and I can't seem to figure out how to change the background of a table cell to a UIImage instead of just the color. Can anyone help me out?

Answer

theChrisKent picture theChrisKent · Mar 15, 2011

You can set the backgroundColor of the cell's contentView with an image pattern like this:

cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];

This will work if the cell is a UITableViewCell or a three20 TTTableViewCell derivative (since they derive from UITableViewCell)