开发者

Retrieving the information in the `change` dictionary from KVO

开发者 https://www.devze.com 2022-12-09 05:44 出处:网络
The method - (void)observeValueForKeyPath:(NSString *)ke开发者_Python百科yPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消