1
votes

I'm attempting to use Cocoa bindings to populate an NSTableView using Core Data entities. I've arrived at a point where I'm boggled by the behavior of my application. The array controller is in "Entity Name" mode and is using the my "Song" entity.

The table view I am attempting to load the data into has two columns: one for the song name and another for the artist name (the artist is another entity which has a relationship to a song). Through Interface Builder, I have been able to successfully bind the array controller to the table, and setup bindings for the two columns. However, for some reason, one of the columns' bindings is working perfectly (artist name) while the other is not populating at all (song name).

I have gone through each view in the Document Outline and ensured that both columns are configured in exactly the same manner. I've attached some screenshots below showing the binding setup in Interface Builder.

Binding on the NSTableColumn representing the Song Title Binding on the NSTableColumn representing the Song Title

Binding on the NSTextField within the NSTableCellView (the one that is not working) Binding on the NSTextField within the NSTableCellView (the one that is not working)

Binding on the NSTextField for Artist Name (the one that is working) enter image description here

The final (non-functioning) result enter image description here

Is there an obvious reason why this approach is not working? Any help would be greatly appreciated. I can also provide any additional information that may be needed to answer this question.

3

3 Answers

2
votes

It appears you are using a "view" based NSTableView as opposed to the older "cell" based. Each have a different configuration for bindings. In a view based table view you have to bind the tableview content to the array controllers arrangedObjects (see below), you don't have to deal with the individual column bindings that is for cell based table views.

Your remaining bindings look fine.enter image description here

0
votes

Just a wild guess. Since you're speaking of the Song entity. Can it be that you have to bind the song name to objectValue.song.title?

0
votes

If 'Artist' isn't just an attribute of the 'Song' entity but an entity itself (which it must likely be if it has a relationship to 'Song') then I think you need to have a separate array controller connected to that column in order for it to work properly.