1
votes

I have a collection view populated with a NSFetchedResultsController. My collection view has sections (the NSFetchedResultsController is configured with a sectionNameKeypath) I need to apply various sorts. To do this, I modify the fetch request of my NSFetchedResultsController and I launch another performFetch.

self.myResultsController.fetchRequest.sortDescriptors = @[myNewSortDescriptor];
[self.myResultsController performFetch:&error];

For each sort, the section name keypath should be updated (if I sort by name, sections should be relative to name, If I sort by city, sections should be relative to cities). But I do not know how to modify section name keypath of an existing NSFetchedResultsController. Should I create a new NSFetchedResultsController at each sort change ?

Regards, Quentin

1

1 Answers

1
votes

Yes, create a new fetched results controller if you need to change the section name key path. If the FRC uses a cache be sure to delete that too.