Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Dividing UITableView into sections by Core Data Attribute
I'm quite the newbie at Core Data, so please bear with me. ;)
In my Data Model, I have a single entity called "Item", with 2 attributes, "Section" and "Name." I already have the UITableView (my main view) populated using by Name, but I want to divide the TableView into 3 different sections, determined by attribute "section." I'm thinking that the "section" attribute should be an integer, so 0 would be the first section, 1 would be the second and 2 would be the third.
I really am not sure how to divide the TableView into the sections. I'm using NSFetchedResultsController. Here's the current code.
- (void)setupFetchedResultsController { // 1 - Decide what Entity you want NSString *dbEntityName = @\"Item\"; // Put your entity name here
// 3 - Filter it if you want //request.predicate = [NSPredicate predicateWithFormat:@\"Item.name = what\"];
// 4 - Sort it if you want request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@\"name\" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]]; // 5 - Fetch it self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; [self performFetch]; }
Also, I was wondering if the Fetch Request template inside the data model in Xcode would help out at all. I see how to create the fetch request, but not how to make it do anything with what it fetches (ex: put the fetched data into a certain TableView section.)
If anyone could help out, it would be greatly appreciated.