I have a table view that goes through an array of data. Data is a set of contacts that may have a reminder time attached to them. For example:
- Jessica
- John
- Bill
- Katrina (February 9)
- Brian (February 11)
Currently, it sorts the table view through the core-data attribute reminderDatein ascending order. It is working correctly. The only catch I would like to use for elements with NULL reminderDatethat should be dumped at the end NSFetchedResultsController, not at the beginning.
Ideally, it would look like this:
- Katrina (February 9)
- Brian (February 11)
- Jessica
- John
- Bill
NSSortDescriptor, NSFetchedResultsController. , NSFetchedResultsController, , .
, :
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"User"];
NSSortDescriptor *sortByDate = [NSSortDescriptor sortDescriptorWithKey:@"reminderDate" ascending:YES];
[fetchRequest setSortDescriptors:@[sortByDate]];
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:context
sectionNameKeyPath:nil
cacheName:nil];
, sortDescriptor, , .