不适用带显示图案的标记
好吧,我对 Cocoa 还很陌生,尤其是 Bindings,但这就是我想要做的。我有一个由两个实体组成的核心数据模型:Category
和 Item
。 Category
与称为 children
的 Item
具有一对多关系,并且 Item
与 Category 具有关系
称为父级
。 Item
有两个 Category
没有的属性:quantity
和 desiredQuantity
。我想做的是在 NSOutlineView 中显示具有两列的树。一列绑定到Category
或Item
的name
。我想在第二列中显示一些类似的内容
2 / 5
Item
行有 ,而 Category
行则没有任何内容。当我使用显示模式时,Category
行最终显示
的
注意到,如果我不对第二列使用显示模式,而只是将其值绑定到 quantity
或 desiredQuantity
,则 类别
行不显示任何内容;仅当我尝试使用显示模式时。
如何使其不显示 Category
行并仍然使用显示模式?或者我可以吗?
编辑: 我想我没有解释 NotApplicable 标记与任何东西有什么关系 - Category
确实有 quantity
和 desiredQuantity
的属性,但它们只是返回 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是自定义 NSFormatter 或只是一个名为“paginationString”的只读 NSString 属性...
This looks like a job for a custom NSFormatter or just a read-only NSString property called "paginationString" ...