objective-c programmatically change table view from standard to grouped?-Collection of common programming errors

You’ll want to use “sections” to split the table.

First you need to sort your datasource into the desired groups, and then reflect it in the view.

A dictionary can easily represent the grouped data. Model each group as an array that contains the entries for that group, and then add it to the dictionary with a key that represents the section.

When the data is ungrouped, you can still use the dictionary, but with a single entry, rather than many, and then reflect that in the UI.

That way when you’re asked how many sections there are in the table you can return [dictionary count]; and then when you’re asked for the number of rows, you can do something like [[dictionary objectForKey@"myKey"] count];

And so on.

When you’ve reconfigured your datasource you can call [self.tableView reloadData]; to reload the table with the sections.