SlackTextViewController icon indicating copy to clipboard operation
SlackTextViewController copied to clipboard

dequeueReusableCellWithIdentifier broken with Storyboard Prototypes and SLKVC

Open owenfi opened this issue 12 years ago • 2 comments

When I change my UITableViewController subclass to subclass SlackTextViewController my cells no longer load properly.

Previously I was using: MessageTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"MCell"];

It worked fine while the class subclassed UITableViewController.

After changing to use SLK, (and registering the class for the reuse) it does still return a cell, but it isn't loading properly. The outlets are all nil and even the non outlet views aren't showing up at all.

Did I miss a setup step somewhere? I had assumed it was basically drop in. I did include the + (UITableViewStyle)tableViewStyleForCoder:(NSCoder *)decoder method.

owenfi avatar Nov 13 '14 13:11 owenfi

SLKTextViewController isn't a UITableViewController subclass, so it doesn't support cell prototypes in storyboards.

Try decoupling the interface builder layout of your cell in a separate nib, and register it as a nib like so:

UINib *messageCellNib = [UINib nibWithNibName:@"MessageTableViewCell" bundle:[NSBundle mainBundle]];
[self.tableView registerNib:messageCellNib forCellReuseIdentifier:@"MCell"];

Haven't tested it, but it should work.

dzenbot avatar Nov 13 '14 16:11 dzenbot

thanks it works! and don't forget to use inverted mode, or the cell will go upside down.

youweit avatar Nov 17 '14 04:11 youweit