textDidChange与controlTextDidChange [英] textDidChange vs controlTextDidChange
本文介绍了textDidChange与controlTextDidChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以向我解释为什么textDidChange无法处理我的委托,而controlTextDidChange可以从NSTextField运行.
- (void)controlTextDidChange:(NSNotification *)aNotification{
NSBeep();
}
来自
- (void)textDidChange:(NSNotification *)aNotification{
NSBeep();
}
解决方案
textDidChange:
是一种方法,当在NSTextField
上调用该方法时,其行为就像其文本已更改一样(包括调用上述方法).这不是您要实现的委托方法.
它与Apple有点不一致,因为它们确实在 解决方案
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屋!
查看全文