I've been searching everywhere on Apple.Developer and Stackflow and haven't come to a clear, standard and proper way of handling this. Basically what I'm looking to do is how to represent more than one customized cell type in a table. Also, there are other tables in the app that will potentially reuse some customized cells.
Most of the time, tables will have the same cell type repeated over and over. But in a few cases, I have a table with a couple types of complex custom cells.
Listed below are the different ways I've learned you can do this. I've tried each one and they all work but I'm unsure of the "proper" way and a way that Apple won't reject.
1) programatically - ultimately, this is the best choice for performance. But if there's a way that I can draw complex customized cells in Interface Builder, it would be the better choice. This is what I'm trying to avoid.
2) a customized cell class with a separate XIB - each customized cell has its own header/implementation/XIB and is a subclass of UITableViewCell. A single cell in a XIB has its file owner set to a specific UITableViewController class. The View here has also been removed.
3) a customized cell in the same XIB as the view controller's XIB - I read that this is bad. A controller should only be associated with a single view in the hierarchy. I included a customized cell in the XIB at the same level as the view and then just linked it up to the controller's IBOutlet.
4) a separate common XIB - this is essentially a dumping ground for customized cells. The view here has also been removed. The XIB contains multiple cells and each cell is associated with a specific subclass of UITableViewCell. A header and implementation file contain the definition and implementation for each cell that is subclassed from UITableViewCell. In the controller that is showing the table, the method cellForRowAtIndexPath, loops through the NSBundle for this common XIB and finds the cell associated with a specific subclass type of UITableViewCell. Then it returns that. This works beautifully for reuse throughout the app but something is telling me it's bad.
What would be the proper way for different cell types in a single table?