Problem with NSPopupButtonCell bindings
开发者_如何转开发I'm trying to achieve something similar to the Apple Master-Detail pop-up cell example but the bindings don't seem to be working for me.
My app allows users to build up a stageplay; so I have a table view of acts
. Each act can have a list of lines
so the acts table view drives a second table view of lines (so selecting act one updates the lines table view with the lines of that act).
This setup seems to be working fine.
Each line is of course spoken by a character, so my document object has a list of characters
as well as a list of acts. What I want is a pop-up cell in my lines table with values taken from the characters
array.
So I followed the steps in that Apple tutorial but it doesn't work...
- If I bind the
content
of the table view column to theCharactersController.arrangedObjects
and theselectedObject
toLinesController.arrangedObjects.character
then the binding works (when I select a value from the pop-up it updates the underlyingline
object with the new character), but the list shows<Character ...>
entries If I then bind the column's
contentValues
toCharactersController.arrangedObjects.name
then I get the following debug error when I run the app:2011-03-16 11:28:49.783 ScriptPreparer[5176:903] Cocoa Bindings: Error setting value <Character: 0x100144f60> of object <NSPopUpButtonCell: 0x100153ff0> through binding selectedObject
If I remove the
selectedObject
binding then I still get the<Character...>
output in the list.
It seems like the contentValues
binding is the broken one. What am I doing wrong?
Here are my bindings:
I discovered what the problem was - I had bindings set on the NSTableView
as well as the Table column and the NSPopupButtonCell
which was causing strange things to happen.
My conclusion is now that any table bindings not on the table column are WRONG
精彩评论