Retrieving information from the `change` dictionary from KVO
Method
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
}
has a parameter change
, which is a dictionary, which contains information about the nature of the change in value, how would you know what was in this dictionary?
+2
source to share
1 answer
Here is a list of the keys used in the change dictionary .
Excerpt:
Keys used by the shift dictionary
These constants are used as keys in the change dictionary passed to
observeValueForKeyPath:ofObject:change:context:
.
NSString *const NSKeyValueChangeKindKey; NSString *const NSKeyValueChangeNewKey; NSString *const NSKeyValueChangeOldKey; NSString *const NSKeyValueChangeIndexesKey; NSString *const NSKeyValueChangeNotificationIsPriorKey;
+9
source to share