如何从CoreData在查看基于NSTableView的填充NSPopupButton [英] How to populate NSPopupButton from CoreData in View Based NSTableView
问题描述
我使用的是使用绑定和阵列控制器与核心数据填充视图基于NSTableViews。一切的伟大工程 - 文本细胞和按钮和细胞图片和文字 - 我可以编辑文本,以及等。
I am using view based NSTableViews that is populated using bindings and array controllers with core data. Everything works great--cells with text and buttons and cells with image and text--I can edit the text as well, etc.
我想不出什么,并到处搜寻是如何填充的弹出菜单。有2个阵列控制器,一个用于表视图,一个用于弹出按钮菜单项。
What I can't figure out and have searched everywhere is how to populate the popup menu. There are 2 array controllers, one for table view and one for popup buttons menu items.
我曾尝试结合在弹出菜单中经典的方式:通过结合内容(arrangedObjects到实体地方),含量值(arrangedObjects Place.name),和选择的对象(表单元格查看objectValue.places.name
I have tried binding the popup menu the classic way: by binding content (arrangedObjects to entity Place), content values (arrangedObjects Place.name), and selected object (Table Cell View objectValue.places.name.
应该不是所有的控制应该像针对基于tableviews正常对照?菜单是没有得到填充。但是,如果的tableView的实体已经有值/关系设置的值被正确地显示。
Shouldn't all the controls should work like normal controls in view based tableviews? The menu is not getting populated. However, if the tableView's entity already has a value/relation set the value is being shown correctly.
任何帮助将是超一流。谢谢,
丹
Any help would be super. Thanks, Dan
推荐答案
我觉得这里有一个错误,我面对完全相同的问题。这里是我的解决方法:
I think there is a bug here, I faced exactly the same problem. Here's my work-around:
而不是直接结合弹出按钮,在IB阵列控制器,我把一个出口(名为arrayController)在我的笔尖的文件的所有者在 NSArrayController的
和绑定弹出按钮,就像这样:
Instead of binding the pop-up button directly to the Array Controller in IB, I put an outlet (named arrayController) in my nib's File's Owner to the NSArrayController
and bound the pop-up button like this:
这篇关于如何从CoreData在查看基于NSTableView的填充NSPopupButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!