Modal Dialog Does Not Dismiss Keyboard

Modal Dialog Does Not Dismiss Keyboard

Overriding disablesAutomaticKeyboardDismissal to return NO as below fixed the same problem of mine. You should put this code to your view controller, from which you initiate the keyboard:

- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}

Also, check this SO question if you want to get a detailed explanation.

iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet

In the view controller that is presented modally, just override disablesAutomaticKeyboardDismissal to return NO:

- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}

How to dismiss keyboard in case of a modal view?

I read that dismissing the keyboard is not possible when presenting as FormSheet?

This is correct. If you'd like to dismiss the keyboard while showing a modal view, you'll have present it using a different modalStyle and you could resize the view to take the same frame as a formsheet.

Avoid modal dismiss on enter keypress

I just had this problem too.

My problem was that i had a close button in my modal


Pressing enter in the input field caused this button to be fired. I changed it to an anchor instead and it works as expected now (enter submits the form and does not close the modal).

×

Without seeing your source, I can't confirm that your cause is the same though.

UITextField's keyboard won't dismiss. No, really

Implement -disablesAutomaticKeyboardDismissal and return NO. It does work on iOS 6, but you have to implement it in the right controller. If you have a modal form sheet navigation controller with a child controller that has text fields, it's the navigation controller that needs the method implementation, not the child.

(See also Dismiss keyboard on IPAD)



Related Topics



Leave a reply



Submit