I have a static UITableView
built from a Storyboard that works well. I want to fill the first category programmatically, though, from a user-defined file
Simply put, I want to go through all the strings in an array and add them as cells for the rows of the first category. For the second category, I have a series of mildly complex cells (containing a number of labels, textfields, buttons and other controls), defined in the storyboard, that I don't feel like recreating in code.
As far as I understand, the default behaviour for a UITableView
built from a storyboard is to use the nib
file as an implicit datasource
. If I use a custom class as datasource
, my second section doesn't work. I have thought of two possible ways to fix this:
- Fill my first category from the
datasource
and delegate the rest to thenib
file. Is this possible? Is there some method to programmatically ask thenib
to fill myUITableView
? - Export my storyboard-built cells into code and paste this code into my
datasource
. This method has the disadvantage of making my second category harder to modify.
Is one of those two options feasible? Is there another option?