2

Cocoa のKey-Value コーディングにより、プロパティへの get/set 操作が簡単になります。とにかく、ドキュメントには、事前定義された命名パターンのみを認識したと書かれています。Declared Propertyはこの機能でサポートできると思います。実は Declared Property の基本的なアクセスは Key-Value コーディングの検索パターンとまったく同じです。問題はカスタム アクセサーです。カスタム アクセサーはプロパティの属性として格納されるため、Key-Value コーディングで簡単にサポートできると思います。しかし、私はこれについての言及を見つけることができません。

カスタム アクセサーで宣言されたプロパティに Key-Value コーディングを使用する場合の通常の動作は何ですか?

4

1 に答える 1

1

If you want to use Key-Value coding, your accessor methods must conform to specific naming conventions. In the section about (custom) accessor method names, the Objective-C Programming Language Guide specifically mentions that you "should [typically] specify accessor method names that are key-value coding compliant."

For details about which names are KVC-compliant, see Accessor Search Implementation Details in the Key-Value Coding Programming Guide.

于 2011-12-13T09:37:41.910 に答える