textDidChange与controlTextDidChange [英] textDidChange vs controlTextDidChange

查看:101
本文介绍了textDidChange与controlTextDidChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以向我解释为什么textDidChange无法处理我的委托,而controlTextDidChange可以从NSTextField运行.

 - (void)controlTextDidChange:(NSNotification *)aNotification{
    NSBeep();
}

来自

 - (void)textDidChange:(NSNotification *)aNotification{
    NSBeep();
}

解决方案

解决方案

controlTextDidChange: is the correct delegate method defined on NSTextField (inherited from NSControl).

textDidChange: is a method that, when called on NSTextField, makes it behave as if its text changed (including calling the above method). It is not a delegate method for you to implement.

It's a little inconsistent of Apple as they do have a textDidChange: delegate method on UISearchBarDelegate.

这篇关于textDidChange与controlTextDidChange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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