mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 11:42:30 +00:00
model updates via binding thourh mpviewcontroller now get registered
This commit is contained in:
@@ -14,7 +14,26 @@
|
||||
|
||||
- (void)didLoadView;
|
||||
- (NSResponder *)reconmendedFirstResponder;
|
||||
/* Returns the associated window controller */
|
||||
- (void)updateResponderChain;
|
||||
|
||||
|
||||
|
||||
#pragma mark Binding Observation
|
||||
/**
|
||||
* Override this to get notificied when setValue:forKeyPath will be called with a keypath starting with representedObject.
|
||||
* This is always called via the binding system, hence it's usefull to anticipate model changes via the ui
|
||||
*
|
||||
* The default implementation calls this just befor setValue:forKeyPath:
|
||||
*
|
||||
* @param keyPath the full key path about to be affected
|
||||
*/
|
||||
- (void)willChangeValueForRepresentedObjectKeyPath:(NSString *)keyPath;
|
||||
/**
|
||||
* Override this to get notified when setValue:forKeyPath was called with a keypath starting with representedObject.
|
||||
* The default implementation calls this right after setValue:forKeyPath:
|
||||
*
|
||||
* @param keyPath the full key path affected
|
||||
*/
|
||||
- (void)didChangeValueForRepresentedObjectKeyPath:(NSString *)keyPath;
|
||||
|
||||
@end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user