I've created a UITableView that is entirely composed of four different groupings. Each section/group has a different number of rows. I've statically added the necessary number of rows and textfields for the bottom three groups. However, I do not know how many rows I will need for the top section/group. I've set up the top group as just having one cell in the .xib, but each time the view loads I am going to have to check how many cells I need and then dynamically add the necessary number of rows to the top section.
I've looked around StackOverflow and have seen people discussing the insertRowsAtIndexPaths methods, but I haven't been able to get it to work.
[settingsPageTableView beginUpdates];
[settingsPageTableView insertRowsAtIndexPaths:tempArray withRowAnimation:UITableViewRowAnimationAutomatic];
[settingsPageTableView endUpdates];
Do I need to put some specific code inside of the insertRowsAtIndexPaths methods? I've passed in an NSMutableArray as so:
NSIndexPath *indexPath0 = [NSIndexPath indexPathForRow:1 inSection:0];
NSMutableArray *tempArray=[NSMutableArray array];
[tempArray addObject:indexPath0];
If anyone has any knowledge of how to combine static and dynamic cells in one UITableView, it would be extremely appreciated! For anyone that is familiar with the bluetooth page from the general settings on the iPhone, this is exactly what I'm looking to do. It has a variable number of devices show up as well as a static cell containing a UISwitch at the top. Does anyone know how to accomplish this?
Thanks a bunch!