在IB的值绑定模型密钥路径中使用KVC运算符,例如@ unionOfSets/@ sum [英] Using KVC operator e.g., @unionOfSets/@sum in IB's Value Binding Model Key Path

查看:55
本文介绍了在IB的值绑定模型密钥路径中使用KVC运算符,例如@ unionOfSets/@ sum的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定是否可以这样做-看起来应该很简单,但是我不断收到实体Sale不符合密钥"@sum"的键值编码要求."

I am not sure if this can be done -- it looks like it should be a straightforward thing but I keep getting "the entity Sale is not key value coding-compliant for the key "@sum"."

我对表列值绑定使用"@ unionsOfSets.departments.@ sale.amount".我做对了,或者做对的正确方法是什么?

I using "@unionsOfSets.departments.@sale.amount" for the Table column value binding. I am doing it right, or what is the right way to do this?

推荐答案

首先,再看看KVC编程指南的.KVC的set和array运算符功能强大,但是很容易弄错它们,即使您已经摸索了该系统.除非您这样做,否则几乎不可能使它们正确.

First, take an other look at the KVC Programming Guide's Set and Array Operators section. KVC's set and array operators are powerful, but it's easy to get them wrong, even after you've grokked the system. And it's nearly impossible to get them right until you do.

也就是说,我认为您的意思是您使用了"@ unionOfSets.departments.@ sum.amount" ,因为您说错误涉及到 @sum @sale 不是合法的KVC运营商.假设这是正确的,并且您具有foo-> * departments-> * sales.amount之类的模型,则可能需要类似

That said, I think you mean you used "@unionOfSets.departments.@sum.amount" since you say the error involves @sum, and @sale isn't a legal KVC operator. Assuming that's right, and that you have a model like foo->*departments->*sales.amount, you probably want something like

"@sum.departments.@sum.sales.amount"

获取所有部门的总销售额.

to get the total sales for all departments.

这篇关于在IB的值绑定模型密钥路径中使用KVC运算符,例如@ unionOfSets/@ sum的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆