Search code examples
cocoacore-datanstableviewnstableviewcell

Cocoa: Core Data + NSTableView


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.


Solution

  • 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.