I have an NSTextField
which I add to the view hierarchy of my custom view and set the position for when the user clicks inside that custom view.
If the text field resigns first-responder status, e.g. because the user has clicked inside another NSTextField
in the window, I need to fetch its value and remove it from the view hierarchy again.
How can my custom view get notified of the NSTextField
it owns resigning first-responder status without having to subclass this text field just for this single purpose?
The NSTextFieldDelegate
method control:textShouldEndEditing:
won't do because it only gets called when the user actually edited something in the text field. I also need to hide the text field if the user didn't make any edits in it.
NSTextField losing focus can be caught by :
- (void)controlTextDidEndEditing:(NSNotification *)aNotification