How to get control class type from object using controlTextDidChange

Example code how to catch the active control id class while entering text using controlTextDidChange and isKindOfClass

Using:
Xcode 4.2.1
Mac OS X 10.7.2
Cocoa

 
Create from the objects (NSTextField or  NSComboBox) an Outlet delegate to your delegate controller in the gui so that controlTextDidChange  NSNotifications are send from these objects.

Place the code in your .m file 
 
 
The code will catch text changes and if the object is of type  NSComboBox  or   NSTextField  a reference is created and the text is replaced per object by the classname.

 

Taxonomy