If Base view controller is a View Controller then override this method
1
2
3
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
Be careful if you are displaying the modal with a UINavigationController
. You then have to set thedisablesAutomaticKeyboardDismissal
on the navigation controller and not on the view controller. You can easily do this with categories.
File: UINavigationController+KeyboardDismiss.h
1
2
3
4
5
6
7
#import <Foundation/Foundation.h>
@interface UINavigationController (KeyboardDismiss)
- (BOOL)disablesAutomaticKeyboardDismissal;
@end
File: UINavigationController+KeyboardDismiss.m
1
2
3
4
5
6
7
8
9
10
#import "UINavigationController+KeyboardDismiss.h"
@implementation UINavigationController(KeyboardDismiss)
- (BOOL)disablesAutomaticKeyboardDismissal
{
return NO;
}
@end
Do not forget to import the category in the file where you use the UINavigationController.
Related links:
http://stackoverflow.com/questions/3372333/ipad-keyboard-will-not-dismiss-if-modal-view-controller-presentation-style-is-ui
http://stackoverflow.com/questions/3372333/ipad-keyboard-will-not-dismiss-if-modal-view-controller-presentation-style-is-ui