Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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
Uitableview 键盘正在隐藏UITextView_Uitableview_Uitextview_Swift4.2 - Fatal编程技术网

Uitableview 键盘正在隐藏UITextView

Uitableview 键盘正在隐藏UITextView,uitableview,uitextview,swift4.2,Uitableview,Uitextview,Swift4.2,我正在为文本字段和文本视图使用以下代码。对于文本字段,它工作正常,但键盘仍隐藏textview @objc func keyboardWillShow(notification: NSNotification) { guard let info = notification.userInfo, let keyboardFrameValue = info[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue else {

我正在为文本字段和文本视图使用以下代码。对于文本字段,它工作正常,但键盘仍隐藏textview

    @objc func keyboardWillShow(notification: NSNotification) {


    guard let info = notification.userInfo, let keyboardFrameValue = info[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue else { return }

    let keyboardFrame = keyboardFrameValue.cgRectValue
    let keyboardSize = keyboardFrame.size

    let contentInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: keyboardSize.height + 100, right: 0.0)
    tableView.contentInset = contentInsets
    tableView.scrollIndicatorInsets = contentInsets
}


    @objc func keyboardWillHide(notification: NSNotification) {
    let contentInsets : UIEdgeInsets = UIEdgeInsets.init(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0)
    self.tableView.contentInset = contentInsets
    self.tableView.scrollIndicatorInsets = contentInsets
    self.view.endEditing(true)
}

任何帮助都将不胜感激。

请使用下面提供的库链接


非常感谢。但我使用了tableView.scrollToRow和textview委托,它起了作用。