Vote count: 0
I think this is not an opinionated question, but rather a question made to know if this is a good practice or not in iOS.
I'm currently doing this registration of custom tableViewCells
in every controller
in my project.
// MARK: Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.tableHeaderView = UIView()
self.tableView.tableFooterView = UIView()
self.tableView.register(R.nib.customCellXX)
self.tableView.register(R.nib.customCellYY)
// and so on...
self.tableView.estimatedRowHeight = 150.0
self.tableView.rowHeight = UITableViewAutomaticDimension
}
I'm just wondering if I could just make a subclass of tableView
and register there all the custom tableViewCells
I have as well as put the auto-height of the tableView
+ tableHeaderView
+ tableFooterView
. In this case, I'm reducing the line of codes in my controllers
and avoiding redundancies.
asked 22 secs ago
Is it okay to register all table view cells in a base table view class?
Aucun commentaire:
Enregistrer un commentaire