键值编码是否支持声明的属性的自定义访问器名称?
Cocoa 的键值编码使属性的获取/设置操作变得简单。无论如何,文档说它只识别预定义的命名模式。我认为此功能可以支持声明的属性。实际上声明属性的基本访问与Key-Value编码的搜索模式相同。问题是自定义访问器。由于自定义访问器存储为属性的属性,因此我认为可以轻松地在键值编码中支持它们。但我找不到关于此的提及。
使用自定义访问器对声明的属性使用键值编码时的常规行为是什么?
Key-Value coding of Cocoa makes get/set operation to properties simple. Anyway documentation says it only recognized pre-defined naming patterns. I think Declared Property could be supported by this feature. Actually basic access of Declared Property is just same with Key-Value coding's search pattern. The problem is custom accessor. Because the custom accessors are stored as an attribute of the property, I think it's easily possible to support them in Key-Value coding. But I can't find mention about this.
What is the regular behavior when using Key-Value coding for the Declared Properties with custom accessors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想使用键值编码,您的访问器方法必须符合特定的命名约定。在有关(自定义)访问器方法名称的部分中, Objective-C 编程语言指南 特别提到您“应该[通常]指定符合键值编码的访问器方法名称。”
有关哪些名称符合 KVC 的详细信息,请参阅 键值编码编程指南中的访问器搜索实现详细信息。
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.