I'm trying to use storyboards in an app I'm working on. In the app there are Lists and Users and each contains a collection of the other (members of a list, lists owned by a user). So, accordingly, I have
UserCell classes. The goal is to have those be re-usable throughout the app (ie, in any of my tableview controllers).
That's where I'm running into a problem.
How do I create a custom tableview cell in the storyboard that can be re-used in any view controller?
Here are the specific things I've tried so far.
In Controller #1, added a prototype cell, set the class to my
UITableViewCellsubclass, set the reuse id, added the labels and wired them to the class's outlets. In Controller #2, added an empty prototype cell, set it to the same class and reuse id as before. When it runs, the labels never appear when the cells are shown in Controller #2. Works fine in Controller #1.
Designed each cell type in a different NIB and wired up to the appropriate cell class. In storyboard, added an empty prototype cell and set its class and reuse id to refer to my cell class. In controllers'
viewDidLoadmethods, registered those NIB files for the reuse id. When shown, cells in both controllers were empty like the prototype.
Kept prototypes in both controllers empty and set class and reuse id to my cell class. Constructed the cells' UI entirely in code. Cells work perfectly in all controllers.
In the second case I suspect that the prototype is always overriding the NIB and if I killed the prototype cells, registering my NIB for the reuse id would work. But then I wouldn't be able to setup segues from the cells to other frames, which is really the whole point of using storyboards.
At the end of the day, I want two things: wire up tableview based flows in the storyboard and define cell layouts visually rather than in code. I can't see how to get both of those so far.