views:

192

answers:

1
[myTextField becomeFirstResponder];
[myTextField resignFirstResonder];

When I do this -(BOOL)textFieldShouldReturn:(UITextField *)textField , it works. But when I use the same code inside -(void)textFieldDidBeginEditing:(UITextField *)textField , it does not work.

I am certain that it is calling textFieldDidBeginEditing. I have an NSLog inside the method and it is being called.

A: 

Before resigning firstResponder status, the textField makes a callback to its own -canResignFirstResponder method, which returns NO if the textField is currently in an edit session. You can implement -textFieldShouldBeginEditing: delegate method to return NO if you want to prevent the editing session from beginning.

jlehr