iPad键盘不会被从视图控制器调用的Facebook对话框中关闭,该视图控制器具有模型视图控制器样式UIModalPresentationFormSheet [英] iPad keyboard will not dismiss from a Facebook dialog called from a view controller with a model view controller style UIModalPresentationFormSheet
问题描述
我已经从模式视图控制器研究并实施了关于键盘解除问题的建议,并在我的UINavigationController中有以下代码:
I have researched and implemented the advice regarding the keyboard dismissing issue from modal view controllers and have the following code in my UINavigationController
- (BOOL)disablesAutomaticKeyboardDismissal
{
return NO;
}
这个工作正常,除非当用户执行下面的Facebook对话不解除键盘
This works fine except for when I call the following Facebook dialog when the user does not dismiss the keyboard
[FBWebDialogs presentRequestsDialogModallyWithSession:...]
我尝试过在SO上找到的所有东西来杀死键盘;我已经走过了每一个视野;我已经尝试了模型转换到一个新的视图控制器,然后调用它;但没有接缝工作。它接缝好像键盘不再附加到视图,所以没有什么可以关闭它了。
I have tried everything I can find on SO to kill the keyboard; I have walked through each view; I have tried model transition to a new view controller and then calling it; but nothing seams to work. It seams as if the Keyboard is no longer attached to a view so there is nothing to dismiss it any more.
当我打电话给对话框时,我没有这个问题其他代码。
I do not have this issue when I call that dialog from other code.
感谢您的帮助。
推荐答案
如果视图控制器显示在导航控制器中,则修复不起作用;
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":
头文件 - UINavigationControllerResponderFix.h:
header file - UINavigationControllerResponderFix.h:
#import <Foundation/Foundation.h>
@interface UINavigationController (ResponderFix)
-(BOOL)disablesAutomaticKeyboardDismissal;
@end
实现文件:
#import "UINavigationControllerResponderFix.h"
@implementation UINavigationController (ResponderFix)
-(BOOL)disablesAutomaticKeyboardDismissal{
return NO;
}
@end
现在,修改你的[applicationname ] -Prefix.pch
Now, modify your [applicationname]-Prefix.pch
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "UINavigationControllerResponderFix.h"
#endif
这就是!
这是对UINavigationController的每个实例进行调整
This does is make an adjustment for every instance of UINavigationController
以上所有 - 从这里: http://www.danielhanly.com/blog/tutorial/resignfirstresponder -bug-in-uimodalpresentationformsheet /
All above - taken from here: http://www.danielhanly.com/blog/tutorial/resignfirstresponder-bug-in-uimodalpresentationformsheet/
这篇关于iPad键盘不会被从视图控制器调用的Facebook对话框中关闭,该视图控制器具有模型视图控制器样式UIModalPresentationFormSheet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!