The method
- (void)observeValueForKeyPath:(NSString *)ke开发者_Python百科yPath 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?
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;
精彩评论