NSPopupButtonCell 绑定问题
我试图实现类似于 Apple Master-Detail 弹出单元示例,但绑定似乎不适合我。
我的应用程序允许用户构建舞台剧;所以我有一个 acts
的表格视图。每个动作可以有一个台词列表,因此动作表视图驱动第二个台词表视图(因此选择第一幕会使用该幕的台词更新台词表视图)。
这个设置似乎运行良好。
当然,每一行都是由一个角色说出的,因此我的文档对象有一个字符
列表以及一个行为列表。我想要的是行表中的弹出单元格,其中的值取自 characters
数组。
因此,我按照 Apple 教程中的步骤操作,但它不起作用...
- 如果我将表视图列的
content
绑定到CharactersController.arrangedObjects
和 < code>selectedObject 到LinesController.arrangedObjects.character
然后绑定起作用(当我从弹出窗口中选择一个值时,它会使用以下内容更新底层line
对象新字符),但是列表显示
条目 如果我随后将列的
contentValues
绑定到< code>CharactersController.arrangedObjects.name 然后我在运行应用程序时收到以下调试错误:2011-03-16 11:28:49.783 ScriptPreparer[5176:903] Cocoa 绑定: 错误设定值<字符:0x100144f60>对象的
通过绑定selectedObject 如果我删除
selectedObject
绑定,那么我仍然会在列表中获得
输出。
看起来 contentValues
绑定已损坏。我做错了什么?
这是我的绑定:
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:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题所在 - 我在
NSTableView
以及 Table 列和NSPopupButtonCell
上设置了绑定,这导致了奇怪的事情发生。我现在的结论是任何不在表列上的表绑定都是错误的
I discovered what the problem was - I had bindings set on the
NSTableView
as well as the Table column and theNSPopupButtonCell
which was causing strange things to happen.My conclusion is now that any table bindings not on the table column are WRONG