I have a NSFetchedResultsController
with section names that may change without any actual changes to the NSFetchedResultsController
s' fetch request entity.
Is there a way to observe changes to the sectionnamekeypath
so that a UITableView
section name will update when one of the names of the NSFetchedResultsController
s' sections is updated?
EDIT:
I use the transient property listNameSectionHeader
, below, as the sectionNameKeyPath
. When a list.name
changes, the section header for that list.name
does not change accordingly, and I am not sure why.
- (NSString*)listNameSectionHeader {
__ENTERING_METHOD__
[self willAccessValueForKey:@"listNameSectionHeader"];
NSString *listNameSectionHeader = [self primitiveValueForKey:@"listNameSectionHeader"];
[self didAccessValueForKey:@"listNameSectionHeader"];
if (listNameSectionHeader == nil) {
listNameSectionHeader = [self recalculateListNameSectionHeader];
}
return listNameSectionHeader;
}
- (NSString*)recalculateListNameSectionHeader {
__ENTERING_METHOD__
NSString *listNameSectionHeader = self.list.name;
[self setListNameSectionHeader:listNameSectionHeader];
return listNameSectionHeader;
}