如何找到一个对象(控制器或视图)辞职的第一个响应者?

时间:2012-07-10 09:13:07

标签: macos cocoa nsresponder

当特定对象重新启动FirstResponder时,我想做一些清理活动。有没有办法检测对象是否已重新响应第一响应者状态。

我需要实施哪些方法来了解这一点?有什么指针吗?

我已经通过了这个链接。但是我没有从中得到很多。

NSTableView & NSOutlineView editing on tab key

1 个答案:

答案 0 :(得分:2)

根据Apples's NSResponder documentation,您应该为您的子类覆盖resignFirstResponder方法。

这样的事情:

- (BOOL)resignFirstResponder
{
    [super resignFirstResponder];
    /* Your cleanup code here */
}