There are two primary techniques for creating custom cells. Just likewith our standard UIView subclass, we can either:
Subclass UITableViewCell and build a custom view hierarchy oneach cell.
Override the drawRect function of our table view cell’s contentViewand draw on the graphics context directly.
Example
Table View
Using CustomUITableViewCells
Picture, for example, the iPod app’s table view cell. In the left you havea UIImage for the cover art, and in the center you have a UILabel forthe song title. All of these objects rest
as a subview to the cell’s view.
In addition to those UI elements, iOS creates an additional blank layerthat you can use to create custom views. Because this blank layer, orcontentView, covers our cell, we can either add subviews or override thedrawRect function
In this code sample, self represents our subclassed UITableViewCell,while myCustomTextLabel is a UILabel that we have created separately.