0
我在使用MacRuby和Cocoa设置值时遇到了一些问题。我已经将QCView和QCPatchController插入到XIB中,并将组合物加载到QCPatchController中。一切正在运行,但我无法访问QCView上发布的输入。forKeyPath遇到Quartz Composer和MacRuby问题
attr_accessor :myQCView #this is bound to the QCController
...
def AppController
txt = "I did it"
@myQCView.setValue(txt, forKeyPath:"patch.text.value")
end
我得到一个错误:
NSUnknownKeyException: [<NSNull 0x7fff7115e000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key value. (RuntimeError)
我难倒。我试图搜索MacRuby论坛,但我没有运气。
谢谢你的建议
嗨,彼得,谢谢你的回应。我从macruby开发论坛获得了一些帮助,并且遇到了错误的对象绑定。当我需要绑定QCView(因此是变量名称)时,我绑定了QCController。我的另一个问题是@。工作的代码是myQCView.setValue(txt,forKeyPath:“patch.text.value”。 – tsugua 2010-09-22 18:05:00