In my app, I have a UITableView that is populated by Core Data, currently a string called "name." I want to be able to divide this tableview into 3 sections, which could be named 0, 1 and 2, or 1, 2 and 3. The name doesn't really matter. I currently really don't know how to achieve this. I have a new attribute in my data model called "term" which is what I want the sections to be based off of. Is it best for this to be an integer?
I'm kind of a newbie at iOS development, so if anyone knows how do this, I would greatly appreciate it .
Here's my current code that sorts that populates the tableview with the "name" attribute.
- (void)setupFetchedResultsController
{
//1 - Entity
NSString *entityName = @"Task"; // Put your entity name here
NSLog(@"Setting up a Fetched Results Controller for the Entity named %@", entityName);
//2 Request
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:entityName];
// 3 - Filter
//request.predicate = [NSPredicate predicateWithFormat:@"Task.name = name"];
// 4 - Sort
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name"
}
Thanks everyone!