textDidChange vs controlTextDidChange

后端 未结 2 1225
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 16:18

Can someone explain me why textDidChange isn\'t handling my delegate but controlTextDidChange works from NSTextField.

 - (void)controlTextDi         


        
相关标签:
2条回答
  • 2021-01-12 16:56

    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.

    0 讨论(0)
  • 2021-01-12 16:59

    textDidChange: Informs the delegate that the text object has changed its characters or formatting attributes.

    I'm guessing that means its font (text attributes) changes, and not the text inputted.

    0 讨论(0)
提交回复
热议问题