Question

I have a class which was the delegate for NSTextViews, for which I was interested in the textDidEndEditing: method. I now want it to also be the delegate for NSTextFields. Problem is, they both use the same method for signaling end of text editing.

I tried to "fork" my textDidEndEditing: method to deal with both NSNotifications, but it seems like the latest (NSTextFields) don't trigger any message.

Should I be looking for an inside bug, or it is a known limitation ?

- (void)textDidEndEditing:(NSNotification *)aNotification
{   if ([[aNotification object] isKindOfClass:[NSTextView class]])
    {

    }
    else if ([[aNotification object] isKindOfClass:[NSTextField class]])
    {

    }
}
Was it helpful?

Solution

Change your method and try below:-

- (void)controlTextDidEndEditing:(NSNotification *)aNotification
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top