Delegate methods of NSTextField using NSNotification
Posted
by hekevintran
on Stack Overflow
See other posts from Stack Overflow
or by hekevintran
Published on 2009-05-12T10:02:11Z
Indexed on
2010/06/01
10:53 UTC
Read the original article
Hit count: 295
I have an NSTokenField in a window. I am using it to store tags related to a Core Data object. Right now I have it set up such that I can add tags to the objects, but I cannot delete them. I need a delegate method on the NSTokenField that can let me know when the user has moved the focus out of the NSTokenField. Since NSTokenField is a subclass of NSTextField I figured that I could use its delegate methods. It has two that I think could be useful:
- (void)textDidChange:(NSNotification *)aNotification
- (void)textDidEndEditing:(NSNotification *)aNotification
I set my controller class as the delegate of my NSTokenField and put both of these methods into my controller class. I put a basic NSLog into each of them and neither is triggered when I interact with the NSTokenField. I am guessing it has something to do with NSNotification. How do I activate these methods?
© Stack Overflow or respective owner