赋值
// 能修改私有成员变量 - (void)setValue:(id)value forKey:(NSString *)key; - (void)setValue:(id)value forKeyPath:(NSString *)keyPath; - (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues;
取值
// 能取得私有成员变量的值 - (id)valueForKey:(NSString *)key; - (id)valueForKeyPath:(NSString *)keyPath; - (NSDictionary *)dictionaryWithValuesForKeys:(NSArray *)keys;
KVC最重要的作用就是修改私有变量。
原文:https://www.cnblogs.com/wwjwb/p/12650489.html