ios - 在自定义键盘 ios8 中关闭键盘不起作用

标签 ios ios8 ios-app-extension custom-keyboard

我在 ios8 中使用关闭键盘方法的自定义键盘扩展遇到了一些问题。

我用 :

来调用它
[self dismissKeyboard];

它编译正常,但是当我按下关闭按钮时它崩溃并打开了普通键盘。在控制台中我只能看到接下来的几行:

2014-08-25 17:38:50.147 customkeyboards[2678:5567685] plugin com.customkeyboards interrupted 2014-08-25 17:38:51.248 customkeyboards[2678:5567651] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7a8dd4c0 {Message=Service Connection Interrupted}

我正在使用 ios 8 beta 6 并将其运行到模拟器中。在具有最新测试版 (ios5) 的设备中也会发生同样的情况

最佳答案

对于遇到同样问题的任何人,这里是解决它的代码!祝你好运!

[self.view endEditing:YES];

self.inputView.frame = CGRectMake( 0, 0, 0, 0 );
self.view.frame = CGRectMake( 0, 0, 0, 0 );
[self.inputView removeFromSuperview ];
[self.view removeFromSuperview ];
for (UIView *v in [self.inputView subviews]){
    [v removeFromSuperview];
}
for (UIView *v in [self.view subviews]){
    [v removeFromSuperview];
}

 [self dismissKeyboard];

关于ios - 在自定义键盘 ios8 中关闭键盘不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25494096/

相关文章:

ios - presentViewController:animated:NO 简要展示了 iOS 8 中的呈现 Controller 。备选方案?

ios - 主机应用程序在哪里处理 NSExtensionContext#completeRequest?

ios - NSUserDefault 无法在 iOS8 的扩展中保存和加载

ios - 我怎样才能从 superView 的中心给约束一些余量

ios - 如何使用核心数据按天分组?

ios - 展开两个 segue

ios - 启动图像命名冲突和 PNG 压缩错误

ios - NSInvalidArgumentException',原因 : 'Resource count cannot be found in the main bundle'

nsstring - NSRange 到 Range<String.Index>

ios - iOS 8 是否支持动态链接?