2
votes

I have a modal View Controller, presented as Form Sheet on the iPad. When I send [textField resignFirstResponder], the Keyboard remains on the screen.

In the View Controller:

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
    return YES;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];

    return YES;
}

In the Navigation Controller:

- (BOOL)disablesAutomaticKeyboardDismissal
{
    return NO;
}

All this worked using iOS 6, but not with iOS 7.

1
Please refer to my answer here which works fine: stackoverflow.com/a/23195187/527539 - ZYiOS

1 Answers

1
votes

Adding the following method to the actual ViewController (rather than the NavigationController) worked for me in iOS 7.

- (BOOL)disablesAutomaticKeyboardDismissal
{
    return NO;
}

I'm calling a method that is hooked to the Text Field's Sent Event Editing Did End.

- (IBAction)KeyboardDoneKeyPressed:(id)sender
{
   [sender resignFirstResponder];
}

Prior to adding the method disablesAutomaticKeyboardDismissal the keyboard would not dismiss when pressing Done.