可可:核心数据+ NSTableView

发布于 2024-08-17 00:54:16 字数 179 浏览 5 评论 0原文

我设置了一个核心数据应用程序,一切都运行良好。但有一个小问题。当我将一个新对象插入到我的实体中时,我将其转到 NSTableViewCell,在那里我可以将其编辑为我想要的文本,但有一个小问题,我可以编辑单元格,但无法取消选择它来保存它对于核心数据,它陷入编辑模式,我摆脱它的唯一方法是退出应用程序,并且它不会保存我刚刚在单元格中指定的新名称。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半﹌身腐败 2024-08-24 00:54:16

Apple 提供的 Core Data 教程中介绍了此类功能。它将让您使用 NSArrayController,这是一个非常有用的类,用于同步视图 (NSTableView) 和模型 (Core Data )。

我相信这是一个了解其工作原理的好地方: http://developer.apple .com/cocoa/coredatatutorial/index.html

希望有帮助。

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.

临走之时 2024-08-24 00:54:16

您使用什么方法将表视图连接到核心数据存储?绑定?数据来源?

我的猜测是你根本没有实现这个。如果您刚刚开始,那么我建议实现一个 NSTableViewDataSource 实例。

http://开发人员。 apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html

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.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文