I have a class ‘EditingField’ extending the NSTextField. The textfields are variables in my AppDelegate.
I wish to do something after the user has ended editing the textfield. Apparently i am to use the controlTextDidEndEditing or textFieldDidEndEditing. Which one am i to use?
Furthermore where exactly am i to implement the methods and how do i set a delegate if that is required?
If you’re using NSTextField (i.e. are developing for OS X) then you’d use
controlTextDidEndEditing. If you’re using UITextField (i.e. are developing for iOS) then you’d be usingtextFieldDidEndEditing.The delegate methods can be implemented in any class you wish, in a very small application perhaps even in the app delegate, otherwise you’d probably implement them in the controller responsible for the part of the UI containing the text field.
To set a delegate, use the
setDelegate:method.