I've done my research and followed the numerous guides for this process, including:
- Adding unknown number of rows to 'Static Cells' UITableView
- https://devforums.apple.com/message/502990#502990
But a recurring theme in the follow-up questions is always "The TableViewCells show up, but they are empty." I assume people solve the problem, but no solutions are posted.
Thus, the stage I am at consists of: the static cells showing up and being correctly filled with data, and the dynamic cells correctly show up in quantity, but not with their elements (they are empty).
I believe I have everything hooked up correctly. I have:
- In my UITableViewController subclass, included and overridden all required methods as marked as "Answer" in the two links above.
- Subclassed UITableViewCell, and included two UILabel properties in the subclass.
- Set the class for the cell in Storyboard to my subclass, and given an appropriate Identifier, which is correctly used in the Controller subclass.
- Placed two UILabels on the cell in storyboard.
- Hooked up the two labels to the properties in the Cell subclass.
I instantiate and assign values to the properties just like in the answers above.
static NSString *CellIdentifier = @"DynamicCell";
OwnersInfoEventsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[OwnersInfoEventsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.eventName.text = @"Name"; //this doesn't show up
cell.eventNeed.text = @"Need"; //this doesn't show up
cell.backgroundColor = [UIColor redColor]; //this works, the cell shows up red
return cell;
What am I missing?