AlwaysUsesMultipleValuesMarker 在 NSTreeController 中做了什么?
根据Apple的文档,
setAlwaysUsesMultipleValuesMarker:
设置当选择多个对象时接收器是否始终返回多个值标记,即使它们具有相同的值。
- (void)setAlwaysUsesMultipleValuesMarker:(BOOL)flag
讨论:
如果您的应用程序不允许编辑多个值,则将标志设置为 YES 可以提高性能。默认为“否”。
然而,即使在阅读了文档之后,我也很难理解这一切的含义。有人可以通过示例提供更简单的解释吗?
According to Apple's documentation,
setAlwaysUsesMultipleValuesMarker:
Sets whether the receiver always returns the multiple values marker when multiple objects are selected, even if they have the same value.
- (void)setAlwaysUsesMultipleValuesMarker:(BOOL)flag
Discussion:
Setting flag to YES can increase performance if your application doesn’t allow editing multiple values. The default is NO.
However, I have trouble understanding what this all means even after reading the documentation. Can anybody offer a simpler explanation with examples?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 可可绑定指南。
NSMultipleValuesMarker
NSMultipleValuesMarker 表示在控制器中选择了多个对象,并且请求的键的值不相同。
默认情况下,仅当请求的键的值不同时,控制器才会返回 NSMultipleValuesMarker。例如,如果 Selection.name 的值返回一个包含三个字符串(“Tony”、“Tony”、“Tony”)的数组,则返回字符串“Tony”,而不是
NSMultipleValuesMarker
。可以使用
setAlwaysUsesMultipleValuesMarker:
方法以编程方式配置集合控制器,或者通过选中 Interface Builder 中的始终使用多个值标记复选框,使其始终返回NSMultipleValuesMarker
当选择多个项目时,即使值相等。Found the answer to this question deep inside apple docs on Cocoa Binding Guide.
NSMultipleValuesMarker
The
NSMultipleValuesMarker
indicates that more than one object is selected in the controller and the values for the requested key aren’t the same.By default controllers return the
NSMultipleValuesMarker
only when the values for the requested key differ. For example, if the value for selection.name returns an array containing three strings—”Tony”, “Tony”, “Tony”—the string “Tony” is returned instead of theNSMultipleValuesMarker
.A collection controller can be configured—either programmatically using the method
setAlwaysUsesMultipleValuesMarker:
or by checking the Always uses multiple values marker checkbox in Interface Builder—such that it always returnsNSMultipleValuesMarker
when multiple items are selected, even if the values are equal.