标签:
当调用setValue:forKey:方法设置属性时,
首先查找set<Key>方法,如果没有此方法,接收器的类方法accessInstanceVariablesDirectly返回YES,开始查找实例变量,查找顺序为:_<key>
, _is<Key>
, <key>
, is<Key>,找到了匹配的就设置该变量的值,如果没有找到,则调用接收器的
setValue:forUndefinedKey:方法。
NOTE: 苹果文档地址 Accessor Search Patterns for Simple Attributes部分
苹果针对数组/集合的操作提供了Collection Operators,如下
@avg
@count
@max
@min
@sum
@distinctUnionOfObjects
@unionOfObjects
@distinctUnionOfArrays
@unionOfArrays
@distinctUnionOfSets
具体用法见官方文档
NOTE:APPLE官方文档的Collection Operators部分
标签:
原文地址:http://my.oschina.net/u/734027/blog/424213