美文网首页
KVC(Key Value Coding(键值编码))

KVC(Key Value Coding(键值编码))

作者: YANGGQ | 来源:发表于2016-03-09 15:42 被阅读38次

    • 全称:Key Value Coding(键值编码)
    • 赋值
    // 能修改私有成员变量
    - (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(Key Value Coding(键值编码))

          本文链接:https://www.haomeiwen.com/subject/rigzkttx.html