i just started two weeks ago with ObjectiveC and i’m a complete noob so, go easy on me.
I want to load a tableView with the following:
Upcoming Events
.event4 xx/xx/2010
.event5 xx/xx/2010
Pass Events
.event1 xx/xx/2008
.event4 xx/xx/2008
.event5 xx/xx/2008
i’m using Core Data with a fetchedResultsCOntroller. What’s the best way to accomplish this?
Best Regards
Ricardo Castro
Set the
sortDescriptorson theNSFetchRequestthat you give to theNSFetchedResultsController. If you have a field that’s calleddateon yourNSManagedObject, you can make a sort descriptor on that key.For separating into sections, you’ll want to add a method on your object that either returns “Upcoming Events” or “Past Events” and then use the name of that method as the
sectionNameKeyPathfor theNSFetchedResultsController.It’s important that the sort that you put in the sort descriptors matches up with how the objects are split into sections. ie. You don’t want any past event being sorted before an upcoming event, but for your case that shouldn’t be too hard. 🙂