我在 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/