Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBOutlet's are nil when using custom tableviewcells in a storyboard

The storyboard has a tableview with one prototype cell, the UITableView has a prototype cell and it has been configured to be the custom UITableViewCell sublclass.

The prototype cell is hooked up to the custom sublcass correctly, the IBOutlets are configured correctly, but for some reason when I get the cell it ends up all my custom subviews are nil.

I've also configured it so that the customIdentifiers are the same.

like image 967
HaloZero Avatar asked Apr 16 '14 00:04

HaloZero


1 Answers

So the problem that I was facing was a weird oversight, when you identify a reuseIdentifier in the storyboard, you don't have to call

- (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier;

on the TableView. If you do, this will actually BREAK the functionality it's intended to do.

When messing with custom UITableViewCells, just set up the reuseIdentifiers to be in common and that will do the registerClass behind the scenes for you I believe. If you do it yourself, it won't work.

like image 162
HaloZero Avatar answered Oct 12 '22 23:10

HaloZero