Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get notified when UITextField becomeFirstResponder

How I can get notified when UITextField becomeFirstResponder ?

I can check like isFirstResponder or set to to become first Responder by becomeFirstResponder

I want to get notified or handle an event when a user make this text field first responder.

Thanks.

like image 290
shebelaw Avatar asked Jan 24 '13 22:01

shebelaw


2 Answers

You will need to be come the text field's delegate and implement this optional delegate method:

- (void)textFieldDidBeginEditing:(UITextField *)textField;  
like image 102
rooster117 Avatar answered Sep 20 '22 20:09

rooster117


Besides implementing the UITextFieldDelegate method textFieldDidBeginEditing:, you can register for the UITextFieldTextDidBeginEditingNotification notification.

The notification method could be:

- (void)someTextFieldDidBeginEditing:(NSNotification *)notification {     UITextField *textField = (UITextField *)notification.object; } 
like image 45
rmaddy Avatar answered Sep 18 '22 20:09

rmaddy