I have subclassed UITextField and would like to get a method called when it becomes the first responder or resigns from the first responder. How can I achieve this?
Just override startFirstResponder to call your method. Sort of,
- (BOOL)becomeFirstResponder { BOOL returnValue = [super becomeFirstResponder]; if (returnValue) { [self method]; } return returnValue; }
For more information on response methods, see the docs: http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/cl/UIResponder
. :
- (void)textFieldDidBeginEditing:(UITextField *)textField{ //call some custom code here... }