My model is a little different, but it can be easily translated to yours. I got a tree structure:
- Element
- Folder: Item
- File: Element
When a file is added or deleted, only the first folder in the queue is notified of this change. When changing the file name, no folders will be notified. So what to do?
I tried to override -willChangeValueForKey: and -didChangeValueForKey: in the Element class.
- (void)willChangeValueForKey:(NSString *)key
{
[super willChangeValueForKey:key];
[self.parent willChangeValueForKey:@"children"];
}
- (void)didChangeValueForKey:(NSString *)key
{
[super didChangeValueForKey:key];
[self.parent didChangeValueForKey:@"children"];
}
, , , .
, .