UITableViewCell - Best place to set up the cell

后端 未结 3 536
独厮守ぢ
独厮守ぢ 2021-01-01 00:50

I\'ve been playing around with custom cells in a UITableViewController by have a base cell (BaseCell - subclass of UITableViewCell) and then subclasses of BaseCell (Sub1Cell

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-01 01:04

    You can use awakeFromNib in your cell subclasses. This will be called when a new cell is created from the prototype in your storyboard, but not when a cell is re-used.

    If you are using prototypes then the whole if (cell == nil) thing goes away, UITableView handles all that for you within the dequeue method.

提交回复
热议问题