簡體   English   中英

取消選中綁定的NSTableview的列內的復選框時出現問題

[英]Problems when deselecting checkboxes inside bound NSTableview's columns

我正在使用aneesh171創建的這個項目該項目顯示了NSTableView中復選框的創建以及如何綁定它們。 我是OSX開發的新手,並試圖了解它的工作原理。

該項目基本上是綁定到陣列控制器的NSTableView列內的復選框。

由於某些原因,當我取消選擇這些復選框之一時,控制台窗口上會顯示以下消息:

2014-04-03 04:22:55.579 MyApp[5735:303] Error setting value for key path objectValue.selected of object <NSAutounbinder: 0x600000258120 - a nonretaining proxy for <NSTableCellView: 0x60000019f890>> (from bound object <NSButton: 0x60000015efb0>): [<__NSDictionaryI 0x61000006f540> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key selected.
2014-04-03 04:22:55.581 MyApp[5735:303] (
    0   CoreFoundation                      0x00007fff87b3a25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff8a3f6e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff87b3a038 +[NSException raise:format:arguments:] + 104
    3   AppKit                              0x00007fff927936c5 -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:] + 837
    4   AppKit                              0x00007fff92793327 -[NSBinder setValue:forBinding:error:] + 245
    5   AppKit                              0x00007fff92c8b4ee -[NSValueBinder _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:] + 194
    6   AppKit                              0x00007fff92c8b871 -[NSValueBinder applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:error:] + 621
    7   AppKit                              0x00007fff927c5107 -[NSValueBinder performAction:] + 288
    8   AppKit                              0x00007fff927c4fc5 -[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:] + 133
    9   AppKit                              0x00007fff927531a0 -[NSControl sendAction:to:] + 56
    10  AppKit                              0x00007fff9279fced -[NSCell _sendActionFrom:] + 128
    11  AppKit                              0x00007fff927b96c5 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2316
    12  AppKit                              0x00007fff927b8a97 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 487
    13  AppKit                              0x00007fff927b81ad -[NSControl mouseDown:] + 706
    14  AppKit                              0x00007fff92739b48 -[NSWindow sendEvent:] + 11296
    15  AppKit                              0x00007fff926d86e4 -[NSApplication sendEvent:] + 2021
    16  AppKit                              0x00007fff92528b89 -[NSApplication run] + 646
    17  AppKit                              0x00007fff92513913 NSApplicationMain + 940
    18  MyApp                               0x0000000100049132 main + 34
    19  libdyld.dylib                       0x00007fff85ffe5fd start + 1

選中復選框后,該消息不會顯示在控制台上。

你們能告訴我怎么了嗎?

我更新了項目的git版本。

每當您通過值綁定來綁定控件時,它就會調用其getter方法來加載值。 而當您嘗試修改這些值時,它將嘗試調用屬性的setter方法。 在項目中,字典是硬編碼的,因此沒有設置方法,這就是為什么您得到“關鍵路徑objectValue.selected的錯誤設置值”的原因。

檢查已創建FruitModel的新版本,該版本解決了setter問題。

如果您遇到任何問題,請告訴我。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM