I have a core data app set up, and everything is working pretty well. But there is one little problem. When I insert a new object into my entity I have it go to my NSTableViewCell, where I can edit it to the text I want, but there's one little issue, I can edit the cell, but I can't deselect it to save it to core data, it's stuck in edit mode and the only way I can get out of it is by quitting the application, AND it doesn't save the new name I just gave it in my cell.
Asked
Active
Viewed 3,741 times
2 Answers
7
This kind of functionality is covered in the Core Data tutorials provided by Apple. It will get you to make use of the NSArrayController
which is a very helpful class for synchronising the view (NSTableView
) and the model (Core Data).
I believe this is a great place to see how this works: http://developer.apple.com/cocoa/coredatatutorial/index.html
Hope that helps.

Tom Duckering
- 2,727
- 1
- 23
- 27
-
That's not the problem. It all works fine and dandy like sour candy, BUT I can't deselect a cell when I add a new object – Matt S. Jan 08 '10 at 02:12
-
There is no custom code (yet). Here's how the bindings are set up: NSArrayCtrler to managed obj context TableColumn value to Arrayctrler tableviewCell value to arrayctrler I followed this guide: http://cocoadevcentral.com/articles/000085.php – Matt S. Jan 08 '10 at 03:00
-
Take another look at the guide, you don't actually bind NSTableViewCell to anything. – sosborn Jan 08 '10 at 04:07
-
But I'm using it in place of an NSTextField – Matt S. Jan 08 '10 at 20:43
-
You bind the column not the cell. This will let the table take care of the edit view for you. – Marcus S. Zarra Jan 11 '10 at 01:42
0
What method are you using to connect the table view to the core data store? Bindings? Data Source?
My guess is that you haven't implemented this at all. If you are just getting starting then I suggest implementing an NSTableViewDataSource instance.

sosborn
- 14,676
- 2
- 42
- 46
-
I don't think NSTableViewDataSource is required for Core Data when using an NSArrayController - especially when requirements are simple. – Tom Duckering Jan 08 '10 at 01:35
-
Tom, yeah, it is not required, but it is good to implement one at least once to give a better understanding of the interaction between the data store and the view. Having said that though, your link to the Rentzsch video is a good one and gets my vote. – sosborn Jan 08 '10 at 02:03