0
votes

I have a strange problem with the iOS Keyboard.

In my app, I am using UITextFields inside some UITableViewCells. I want to dismiss the keyboard if the current textfield loses its focus.

This is what I've done so far:

  • Set up the <UITextFieldDelegate> and add [textField resignFirstResponder] to textFieldDidEndEditing:

  • -> textFieldDidEndEditing gets called, but the keyboard stays.

  • Added all TextFields to an array, looped through all objects and call resignFirstResponder

  • -> No effect

  • Called [self.tblView endEditing:YES] inside textFieldDidEndEditing.

  • -> Keyboard didn't disappear.

But dismissing the keyboard by using the Done-Button works perfectly (using textFieldShouldReturn)

What am I doing wrong?

Edit: I've made a video of my problem: http://www.youtube.com/watch?v=Zuz5rCv2GCo

1
How does the textfield knows that editing did end?dasdom
When I exit the textfield by getting into another oneeltomato
Then you are in the next textfield -> keyboard visible.dasdom
Normally you are right! But I am using the TextFields inside a TableView. So If I tap on another TextField (in another row), the first one loses its focus and the second one isn't focused. (And the keyboard stays visible)eltomato
I made a Video of the problem .. >Youtube< any ideas?eltomato

1 Answers

0
votes

try implementing following:

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    [textField becomeFirstResponder];
}

-(void)textFieldDidEndEditing:(UITextField *)textField
{
    [self resignFirstResponder];
}