views:

43

answers:

1

I use an NSFetchedResultsController to populate a UITableView, and would like to know if it is possible to create different sections based on an attribute of my data model.

I am displaying a table of objects, and one of the properties of the objects is a BOOL that is set to indicate whether or not the object is active. I would like to break the records apart in the UITableView and have section one display the objects with Active==YES and the second section display objects that are not active.

How is this done? Thank you!

+1  A: 

You set the sectionNameKeyPath: of the NSFetchedResultController initialization method to the name of the attribute you want to use for the sections. The FRC returns a section for each unique value of that attribute.

TechZen