I don’t know why my keyboard doesn’t dismiss when a textfield has finished to be edited. This is the content of the textfield delegate. (I’ve implemented both method just for testing purposes):
-(void)textFieldDidEndEditing:(UITextField *)textField
{
[textField resignFirstResponder];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return NO; //I've also tried YES
}
Both method are correctly invoked but the keyboard remains active. Why ?
Thanks
First off, the
textFieldShouldReturnshould return YES.Second, make sure the UITextField’s delegate is the file’s owner
If you use interface builder, you can do it with control drag
or
if you create it from code, than in
viewDidLoadyou must have the following line[yourTextField setDelegate:self];