Is there a way to have the sort descriptor(s) be dynamically set for a fetched results controller on iOS?
For instance, I need to have the core data results returned to me sorted based on the setting of a segmented control in the navigation title bar. The user can either click the segmented control to sort by Price or Priority.
I then need the fetched results controller to return and display the core data info sorted into sections based on that segmented control value.
I know how to set the sort descriptors initially, but I'm uncertain how to change it/update it dynamically. Since the - (NSFetchedResultsController *)fetchedResultsController
function is lazy loaded, wont it always just return the frc that was created the first time through (thus returning the initial sort descriptor setting)?
Would I do something like store the segmented control value in a the sharedPreferences, and then when it is changed, set my fetchedResultsController to nil so that a new one will be generated? Then within the fetchedResultsController function I can create my sortDescriptor based on that sharedPreferences setting?