Iphone – Custom UITableViewCell with Subtitle style

iphoneuitableview

I used this guide: http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder to be able to create my own custom UITableViewCell with a nice background image in interface builder. But I would like the style of the cell to be UITableViewCellStyleSubtitle to still be able to use textLabel and detailTextLabel for my custom cell. Can I in some way set the style of the cell in interface builder?

Now only the textLabel is set when using:

cell.textLabel.text = @"Title";  
cell.detailTextLabel.text = @"Details";

Also I use a transparent image as background, but textLabel has white background. Can I change this in interface builder? Or do you think I should just add my own labels to the custom cell in interface builder and skip the standard textLabel and detailTextLabel?

Thanks for your help!

Best Answer

Use Option B. Either fully use your own custom cell, or fully use Apple's styled cell. Trying to mix and match is not forward compatible.

If you want a convenient property for the detailTextLabel, subclass UITableViewCell and return the UILabel you create in the nib. Give it a different name than detailTextLabel.

Related Topic