0

Does anyone have any info on this? I'm new to cocoa, all tutorials seem to be for iPhone which uses a different view controller. Anyone willing to provide a step by step for adding labels to a custom cell? (I'm pulling from Core Data)

EDIT: It's important to note I'm using Core Data here. Many tutorials use arrays.. I don't understand why you would use that??

I'll award an answer quickly!

Zach

Zakman411
  • 1,764
  • 3
  • 22
  • 45
  • possible duplicate of [NSTableView with custom cells](http://stackoverflow.com/questions/910267/nstableview-with-custom-cells) – David Gelhar Feb 16 '11 at 04:11
  • @David Gelhar: Would you mind elaborating on this? After reading that thread I'm still a bit confused.. How does XCode factor into all of this? Why is it necessary to create instance variables when I'm pulling my data from Core Data? – Zakman411 Feb 16 '11 at 05:18

1 Answers1

0

I'm not sure if this is going to help you, but your problem seems unrelated to your use of CoreData.

If I've understood your problem correctly, here are some steps:

Populate your NSTableView

Using CoreData, what you can do is put an NSArrayController object in your XIB document, set its mode to Entity and choose the Entity you want to display in your TableView (all of this from the first tab of the inspector on your array controller object).

Then, bind your NSTableView Content to the arrangedObjects of the array controller. You might also bind the selectionIndexes and use some sort descriptors on the array controller to order your data, as CoreData will give you a set rather than an array.

Click on your table view as many times as necessary as to select the table column in which you want your custom cell to appear, and set its Value binding to arrangedObjects too.

Set your custom cell

Finally, click on the cell of this table column and in the "Identity" of the inspector, change the class name of the cell to the class name of your custom cell.

I'll let you read the appropriate documentation to implement your custom cell according to what you want to achieve. With the different bindings I've described, the objectValue of your cell should be the object from your array controller at the same index of the row your cell will appear on.

Please note that I've not tested again all of these steps but answered from memory... there might be details I've missed but you should have the main steps here.

Olivier Lance
  • 1,738
  • 17
  • 30