选择TextField时,导航栏被推出安全区域

时间:2019-11-02 02:19:35

标签: ios swift xcode uinavigationbar

我使用以下代码制作了一个以模态形式呈现的viewController:

      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath as IndexPath, animated: true)
        if let destination = storyboard?.instantiateViewController(withIdentifier:"MainTextView") as? MainTextView {

            destination.post = (posts[indexPath.row])
            destination.delegate = self
            present(destination, animated: true, completion: nil)

            }
        }
    } 

我的约束是导航栏的顶部与安全区域的顶部对齐。

当我选择textField时,出现完成按钮栏,将导航栏推出安全区域。

在选择文本字段之前查看控制器:

View Controller Before Selecting Text Field

选择文本字段后,查看控制器: View Controller After Selecting Text Field

注意:我正在使用IQKeyBoardManager:

https://github.com/hackiftekhar/IQKeyboardManager

我可以禁用IQKeyBoardManager,但随后键盘将覆盖textView

如何解决此问题并使导航栏锁定在安全区域内?

0 个答案:

没有答案