I think that the following should work:
- Use your
date
field as first sort descriptor. - Define a transient attribute
sectionIdentifier
and use that assectionNameKeyPath
. Define the getter function for the transient property that returns only "0" or "1". In the simplest case (without caching), it would look like this:
- (NSString *)sectionIdentifier { if (self.date == nil) return @"0"; else return @"1"; }
Implement a custom
titleForHeaderInSection
:- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; if ([[sectionInfo name] isEqualToString:@"0"]) return @"Date is nil"; else return @"Date is not nil"; }