Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios MessageKit InputBar在ViewController上隐藏/删除_Ios_Swift_Inputaccessoryview_Messagekit_Inputbaraccessoryview - Fatal编程技术网

Ios MessageKit InputBar在ViewController上隐藏/删除

Ios MessageKit InputBar在ViewController上隐藏/删除,ios,swift,inputaccessoryview,messagekit,inputbaraccessoryview,Ios,Swift,Inputaccessoryview,Messagekit,Inputbaraccessoryview,我正在使用MessageKit3.0.0-swift5分支进行聊天。 单击消息,我将显示ViewController。 当Viewcontroller关闭时,我无法访问InputBar 有人遇到过这个问题吗 查看视频 代码: 我也在使用IQKeyboardManager,但下面的解决方案不起作用 override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) IQKeyboardMan

我正在使用MessageKit
3.0.0-swift5
分支进行聊天。 单击消息,我将显示ViewController。 当Viewcontroller关闭时,我无法访问InputBar

有人遇到过这个问题吗

查看视频

代码:

我也在使用IQKeyboardManager,但下面的解决方案不起作用

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    IQKeyboardManager.shared().isEnabled = false
}

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    IQKeyboardManager.shared().isEnabled = true
}

我认为您必须在演示下一个ViewController之前通过
TextView.resignFirstResponder()
禁用键盘,因为问题是在ViewController演示时开始的我以前也遇到过这个问题,但我试图通过添加以下代码来演示
nextViewController
。希望它能起作用

 nextViewController.modalPresentationStyle = .overCurrentContext
 nextViewController.modalTransitionStyle = .coverVertical

我的应用程序中也有同样的问题,那就是只使用
InputBarViewController
(出于某些原因,我不得不实现自己的聊天,而不是使用MessageKit)

因此,如果您试图显示非当前控制器的某个模态视图控制器,或者甚至将第一响应者焦点移动到当前VC中的另一个
UITextField
(例如搜索字段),则很容易再现此问题。 对于我来说,工作的解决方案是在从搜索字段中退出控件后,在当前视图控制器实例上调用
becomeFirstResponder
,或者在
视图中显示
(或者在您可以确定的其他地方,聊天界面再次可见)


另一方面,当
UIContextMenu
(长时间触摸手机)被取消时,我也面临着这个问题。解决方案基本相同。

如果您仍然有问题,请告诉我如何找到解决方案解除键盘功能不起作用。这是非常随机的行为。我正在使用JSQ,但同样的问题。显示本机摄像头应用程序后,InputToolBar消失。调用resignFirstResponder没有任何作用,因为ViewController会在出现新的ViewController时辞职FirstResponder,同时inputToolBar会被解除。我使用的是JSQ,但问题相同。显示本机摄像头应用程序后,InputToolBar消失。
 nextViewController.modalPresentationStyle = .overCurrentContext
 nextViewController.modalTransitionStyle = .coverVertical