KVC
- KVC全称为Key-Value Coding,俗称“键值编码”,可以通过一个key来访问某个属性
- 常见的API有:
- (void)setValue:(nullable id)value forKey:(NSString *)key;
- (nullable id)valueForKeyPath:(NSString *)keyPath;
- (nullable id)valueForKey:(NSString *)key;
- (void)setValue:(nullable id)value forKeyPath:(NSString *)keyPath;
网友评论