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.
A:
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
2010-01-08 01:22:08
I don't think NSTableViewDataSource is required for Core Data when using an NSArrayController - especially when requirements are simple.
Tom Duckering
2010-01-08 01:35:42
I'm using bindings
Matt S.
2010-01-08 01:45:33
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
2010-01-08 02:03:52
+4
A:
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://rentzsch.com/links/adcCoreDataVideoTutorial
Hope that helps.
Tom Duckering
2010-01-08 01:33:56
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.
2010-01-08 02:12:58
If you can't deselect the cell then it is most certainly not working fine and dandy like sour candy.At this point it would be best to show us your code. If you have not written any custom code yet then describe in detail how the bindings of the controllers and table column are set up.
sosborn
2010-01-08 02:32:50
There is no custom code (yet). Here's how the bindings are set up:NSArrayCtrler to managed obj contextTableColumn value to ArrayctrlertableviewCell value to arrayctrlerI followed this guide: http://cocoadevcentral.com/articles/000085.php
Matt S.
2010-01-08 03:00:50
Take another look at the guide, you don't actually bind NSTableViewCell to anything.
sosborn
2010-01-08 04:07:32
You bind the column not the cell. This will let the table take care of the edit view for you.
Marcus S. Zarra
2010-01-11 01:42:11