Question

The method

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
}

has a parameter change which is a dictionary that contains information about the nature of the value change, how would I find out what was in this dictionary?

Was it helpful?

Solution

Here's a list of the keys used by the change dictionary.

An extract:

Keys used by the change 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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top