Jos*_*hua 2 cocoa objective-c key-value-observing
方法
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
}
Run Code Online (Sandbox Code Playgroud)
有一个参数change是一个字典,其中包含有关值更改性质的信息,我将如何找出此字典中的内容?
提取物:
更改字典使用的键
这些常量用作传递给的更改字典中的键
observeValueForKeyPath:ofObject:change:context:.Run Code Online (Sandbox Code Playgroud)NSString *const NSKeyValueChangeKindKey; NSString *const NSKeyValueChangeNewKey; NSString *const NSKeyValueChangeOldKey; NSString *const NSKeyValueChangeIndexesKey; NSString *const NSKeyValueChangeNotificationIsPriorKey;