Ipad Keyboard Will Not Dismiss If Modal Viewcontroller Presentation Style Is Uimodalpresentationformsheet

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;
}

iPad keyboard will not dismiss from a Facebook dialog called from a view controller with a model view controller style UIModalPresentationFormSheet

The above "fix" does not work if the view controller is presented inside a navigation controller;

You have to create a category with this "fix":

header file - UINavigationControllerResponderFix.h:

#import <Foundation/Foundation.h> 
@interface UINavigationController (ResponderFix)

-(BOOL)disablesAutomaticKeyboardDismissal;

@end

implementation file:

#import "UINavigationControllerResponderFix.h"

@implementation UINavigationController (ResponderFix)

-(BOOL)disablesAutomaticKeyboardDismissal{
return NO;
}

@end

Now, modify your [applicationname]-Prefix.pch

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

#import "UINavigationControllerResponderFix.h"
#endif

That's it!

This does is make an adjustment for every instance of UINavigationController

All above - taken from here: http://www.danielhanly.com/blog/tutorial/resignfirstresponder-bug-in-uimodalpresentationformsheet/

How to HIDE the iPad keyboard from a MODAL view controller?

It was because I was using UIModalPresentationFormSheet. All of the other ones work as expected.... Wasted several hours on that.

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.

With UIPresentationFormSheet, why doesn't my view move above the keyboard when it is up?

As I was finishing up my question, I realized I was calling becomeFirstResponder on my UITextView in viewWillAppear. If you change it to viewDidAppear it will work, which makes sense.

How do I dismiss a Modal View Controller Form Sheet in Landscape on iPad containing a UITextView?

The keyboard will be removed only after the modal form is dismissed. Apple has the idea that if you are using modal form, then you'll need the keyboard for multiple fields therefore it shouldn't be removed.



Related Topics



Leave a reply



Submit