I have a UITableViewController subclass with its prototype cells mocked up in the storyboard.
There’s a fair amount of code in the cellForRowAtIndexPath delegate method that sets up the cells. Problem is I don’t need most of it if the cell is just being dequeued from the reuse pool, because it’s already been done when the cell was dequeued the first time. I can’t do it in the storyboard because there are some properties I can only access programmatically.
Does the UITableViewController call an initializer in my UITableViewCell subclass when it takes a prototype cell from the storyboard? I tried (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier but that does not appear to be part of the process.
When a UITableView instance calls for
dequeueReusableTileWithIdentifier:, the cell is not reinitialized. Instead, in that call, the UITableViewCell that is dequeued will call-(void)prepareForReuse. This is because reinitializing the cell is costly, and if we can provide a much simpler method for preparing for its reuse (eh, eh, get it?) it saves a whole lot of CPU work.Ergo, if you’re using custom cells, override UITableViewCell
prepareForReuse.