Cocoa: Basic Data + NSTableView

I have an application for creating basic data, and everything works very well. But there is one small problem. When I insert a new object into my object, I go to my NSTableViewCell, where I can edit it to the text I want, but there is one small problem, I can edit the cell, but I can’t undo it to save it to the main data, it’s stuck in edit mode, and the only way I can exit it is to exit the application, and it does not save the new name that I just gave in my cell.

+3
source share
2 answers

This kind of functionality is described in the Core Data tutorials provided by Apple. This will help you use one NSArrayController, which is a very useful class for synchronizing the view ( NSTableView) and model (master data).

I believe this is a great place to see how it works: http://developer.apple.com/cocoa/coredatatutorial/index.html

Hope this helps.

+7
source

What method do you use to connect the table view to the main data store? Handcuffs? Data source?

I assume that you did not realize this at all. If you are just starting out, I suggest implementing an instance of NSTableViewDataSource.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html

0

Source: https://habr.com/ru/post/1727716/


All Articles