用户完成在NSTableView中的单元格编辑后如何获得通知? [英] How can I get notified when the user finishes editing a cell in an NSTableView?

查看:92
本文介绍了用户完成在NSTableView中的单元格编辑后如何获得通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道用户何时完成NSTableView中的单元格编辑.该表包含所有用户的日历(从CalCalendarStore获取),因此,为了保存用户的更改,我需要将这些更改通知CalCalendarStore.但是,在用户完成编辑后,我找不到任何要调用的东西-我猜在表的委托中会有一个方法,但是我只看到一个在编辑开始时被调用的方法,而不是在编辑结束时被调用的方法./p>

I need to know when the user finishes editing a cell in an NSTableView. The table contains all of the user's calendars (obtained from the CalCalendarStore), so in order for the user's changes to be saved I need to inform the CalCalendarStore of the changes. However, I can't find anything that gets called after the user finishes their editing - I would guess that there would be a method in the table's delegate, but I only saw one that gets called when editing starts, not when editing ends.

推荐答案

子类NSTableView并重写textDidEndEditing :(确保调用super的实现).

Subclass NSTableView and override textDidEndEditing: (be sure to call super's implementation).

这将仅由文本字段NSTextFieldCell或NSComboBoxCell调用(但仅在通过键入值更改值时,而不是通过从组合菜单中选择值来更改).

This will only be invoked by text fields NSTextFieldCell or NSComboBoxCell (but only when changing the value by typing it, not by selecting the value from the combo's menu).

这篇关于用户完成在NSTableView中的单元格编辑后如何获得通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆