I have an NSTokenField in the window. I use it to store tags associated with a Core Data object. Right now I have it configured in such a way that I can add tags to objects, but I can’t delete them. I need a delegation method on an NSTokenField that can tell me when a user has moved focus from an NSTokenField. Since NSTokenField is a subclass of NSTextField, I decided that I could use its delegation methods. I have two that, in my opinion, can be useful:
- (void)textDidChange:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
I set my controller class as a delegate of my NSTokenField and put both of these methods in my controller class. I put the base NSLog in each of them, and none of them start when I interact with the NSTokenField. I guess this has something to do with NSNotification. How to activate these methods?
source
share