ios - Can I safely use dequed tableView cell as prototype -
i using prototype cell calculate real cell height. since i'm using storyboard have chosen create prototype cell dequeing it. example code:
- (mycell *)prototypepriceoptioncell { if (_prototypecell == nil) { _prototypecell = (mycell *)[self.tableview dequeuereusablecellwithidentifier:cellidentifier]; } return _prototypepriceoptioncell; }
this prototype never returned tableview
in cellforrowatindexpath
method.
will dequed table view reuse , show in table view?
you technically could, docs:
if registered class specified identifier , new cell must created, method initializes cell calling initwithstyle:reuseidentifier: method. nib-based cells, method loads cell object provided nib file. if existing cell available reuse, method calls cell’s prepareforreuse method instead.
but states can return nil under circumstances. however, wouldn't use approach, not because wouldn't work because it's not supposed used that. means have weak code relying on feature it's not supposed used that.
my suggestion, instantiate cell manually calling appropriate methods. also, have cells on separate xibs, away storyboards.
edit: answering question @ end, yes, cell can , dequeued table view if call dequeue in cellforrowatindexpath
Comments
Post a Comment