The method discussion for setValue:forKeyPath:
in Apple's NSKeyValueCoding
Protocol documentation starts with:
对setValue的方法讨论:forKeyPath:在苹果的NSKeyValueCoding协议文档中开始:
The default implementation of this method [...]
该方法的默认实现[…]
Now, this might just be me getting caught with semantics but:
现在,这可能只是我被语义学抓住了,但是:
- How can an Objective-C Protocol have a default implementation?
- Objective-C协议如何有默认实现?
- Since NSObject doesn't appear to conform to this protocol, how would one be able to take advantage of this default implementation in their own NSObject subclasses?
- 既然NSObject似乎不符合这个协议,那么如何在自己的NSObject子类中利用这个默认实现呢?
1 个解决方案
#1
5
NSKeyValueCoding is an informal protocol, which means it's implemented as a category (in this case, on NSObject
). The NSObject
class provides the default implementation of the methods declared in the category.
NSKeyValueCoding是一种非正式的协议,这意味着它是作为一个类别实现的(在本例中是NSObject)。NSObject类提供在类别中声明的方法的默认实现。
#1
5
NSKeyValueCoding is an informal protocol, which means it's implemented as a category (in this case, on NSObject
). The NSObject
class provides the default implementation of the methods declared in the category.
NSKeyValueCoding是一种非正式的协议,这意味着它是作为一个类别实现的(在本例中是NSObject)。NSObject类提供在类别中声明的方法的默认实现。