I dropped a UITextField into a view controller via Interface Builder called *txtNameField, added the UITextFieldDelegate to my view controller, and then set the field’s delegate to self in the viewDidLoad of the view controller. I made a call to
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
NSLog(@"textFieldShouldReturn");
[textField resignFirstResponder];
return YES;
}
but the return key does not dismiss the keyboard.
Any ideas?
Link a method to your textField’s
didEndOnExitevent and put[textField resignFirstResponder];in that method.