model updates via binding thourh mpviewcontroller now get registered

This commit is contained in:
michael starke
2016-08-24 16:25:06 +02:00
parent 55ab84b6bd
commit f01480c2bd
2 changed files with 40 additions and 1 deletions

View File

@@ -38,4 +38,24 @@
}
}
#pragma mark Binding observation
- (void)setValue:(id)value forKeyPath:(NSString *)keyPath {
if([keyPath hasPrefix:@"representedObject."]) {
[self didChangeValueForRepresentedObjectKeyPath:keyPath];
[super setValue:value forKeyPath:keyPath];
[self didChangeValueForRepresentedObjectKeyPath:keyPath];
}
else {
[super setValue:value forKeyPath:keyPath];
}
}
- (void)willChangeValueForRepresentedObjectKeyPath:(NSString *)keyPath {
NSLog(@"[%@ willChangeValueForRepresentedObjectKeyPath:%@]", NSStringFromClass([self class]), keyPath);
}
- (void)didChangeValueForRepresentedObjectKeyPath:(NSString *)keyPath {
NSLog(@"[%@ didChangeValueForRepresentedObjectKeyPath:%@]", NSStringFromClass([self class]), keyPath);
}
@end