slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

dequeueReusableCellWithIdentifier broken with Storyboard Prototypes and SLKVC #68

Closed owenfi closed 10 years ago

owenfi commented 10 years ago

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

dzenbot commented 10 years ago

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.

youweit commented 10 years ago

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