NSPopupButton in view based NSTableView: getting bindings to work

懵懂的女人 提交于 2019-12-03 03:26:17

I had the same problem. I've put a sample project showing this is possible on Github.

Someone suggested a workaround using an IBOutlet property to the Authors array controller but this doesn't seem to work for me either.

This is the approach that did work for me, and that is demonstrated in the sample project. The missing bit of the puzzle is that that IBOutlet to the array controller needs to be in the class that provides the TableView's delegate.

Tom

Had the same problem and found this workaround - basically get your authors array controller out of nib with a IBOutlet and bind to it via file owner.

You can try this FOUR + 1 settings for NSPopUpbutton:

In my example, "allPersons" is equivalent to your "Authors". I have allPersons available as a property (NSArray*) in File's owner.

Additionally, I bound the tableView delegate to File's owner. If this is not bound, I just get a default list :Item1, Item2, Item3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!