textDidChange: 是一种方法,当在NSTextField上调用该方法时,其行为就像其文本已更改一样(包括调用上述方法).这不是您要实现的委托方法.它与Apple有点不一致,因为它们确实在 UISearchBarDelegate .Can someone explain me why textDidChange isn't handling my delegate but controlTextDidChange works from NSTextField. - (void)controlTextDidChange:(NSNotification *)aNotification{ NSBeep();}from - (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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 05:57