不适用带显示图案的标记

发布于 2024-09-03 09:28:25 字数 1003 浏览 5 评论 0原文

好吧,我对 Cocoa 还很陌生,尤其是 Bindings,但这就是我想要做的。我有一个由两个实体组成的核心数据模型:CategoryItemCategory 与称为 childrenItem 具有一对多关系,并且 ItemCategory 具有关系 称为父级Item 有两个 Category 没有的属性:quantitydesiredQuantity。我想做的是在 NSOutlineView 中显示具有两列的树。一列绑定到CategoryItemname。我想在第二列中显示一些类似的内容

2 / 5

Item 行有 ,而 Category 行则没有任何内容。当我使用显示模式时,Category 行最终显示

注意到,如果我不对第二列使用显示模式,而只是将其值绑定到 quantitydesiredQuantity,则 类别行不显示任何内容;仅当我尝试使用显示模式时。

如何使其不显示 Category 行并仍然使用显示模式?或者我可以吗?

编辑: 我想我没有解释 NotApplicable 标记与任何东西有什么关系 - Category 确实有 quantitydesiredQuantity 的属性,但它们只是返回 NSNotApplicableMarker。

Ok, so I'm pretty new to Cocoa, especially Bindings, but here's what I'm trying to do. I've got a Core Data model consisting of two entities: Category and Item. Category has a to-many relationship to Item called children, and Item has a relationship to Category called parent. Item has two attributes that Category does not have: quantity and desiredQuantity. What I'd like to do is display the tree in an NSOutlineView with two columns. One column is bound to the name of either the Category or the Item. I want to the second column to display something along the lines of

2 of 5

for the Item rows and nothing at all for the Category rows. When I use a display pattern, the Category rows end up showing

of

I noticed that if I don't use a display pattern for the second column, and instead just bind its Value to either the quantity or the desiredQuantity, the Category rows show nothing; its only if I try to use the display pattern.

How can I make it display nothing for the Category rows and still use the display pattern? Or can I?

Edit:
I guess I didn't explain what the NotApplicable marker has to do with anything - Category does have properties for quantity and desiredQuantity, but they just return NSNotApplicableMarker.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鼻尖触碰 2024-09-10 09:28:25

这看起来像是自定义 NSFormatter 或只是一个名为“paginationString”的只读 NSString 属性...

This looks like a job for a custom NSFormatter or just a read-only NSString property called "paginationString" ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文