tom
tom

Reputation: 14513

how to subclass UITableViewCell if the content/height of each cell varies

I have a UITableView. The height and content of each cell of the table view varies, depending on the data feeding to the cell. To give an example - some might have pictures, some might only have text; some might have 1 picture, some might have more than 1 picture. So, I am thinking about subclassing the UITableViewCell so I can use the subclass in other table views that I might have.

Is there some sample code that I can follow to achieve that goal - subclassing UITableViewCell, varied content, varied height?

Upvotes: 0

Views: 791

Answers (1)

rickster
rickster

Reputation: 126137

This has been asked many times.

Also, you don't need to subclass to get variable row height, nor to put custom controls into the cell, but for the latter case subclassing may be convenient.

Upvotes: 1

Related Questions