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