views:

169

answers:

2
  1. In my AppDelegate I create an NSFetchedResultsController with sectionNameKeyPath set to @"group".
  2. In viewWillAppear in my TableViewController I performFetch, then call a method called findGroups.
  3. findGroups does some complicated analysis of the entire dataset to identify groups, then sets the "group" transient property on each object to the correct string value. I can see with NSLog that these are all set correctly and in coherent groups.

But, tinker as I may, my cells are shown in a single section with the title of the first group. Any ideas?

A: 

Have you implemented:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [[fetchedResultsController sections] count];
}

You also have the problem that the sectionNameKeyPath can't be a transient value.

Paul Lynch
A: 

Actually, this worked fine for me by adding a step 4: [self.tableView reloadData];

Elon