As I understand, there seem to be three ways of laying out a custom table view cell:
- In Interface Builder.
- In
layoutSubviews
. - In
initWithStyle:reuseIdentifier:
.
What's the difference between the second and third methods? Also, why not drawRect
?
P.S. I'm following Chapter 9 of the book Pro iOS Table Views by Tim Duckett, where we're building custom UITableViewCell
s. The author shows how to lay out the cell in the same order as above, but I don't know whats the difference between the last two since they both do away with IB. I noticed, though, that the author simply sets the frames in layoutSubviews
unlike in initWithStyle:reuseIdentifier:
where properties concerning the look of a view are set (e.g., background image, background color, etc.).