我使用以下代码制作了一个以模态形式呈现的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时,出现完成按钮栏,将导航栏推出安全区域。
在选择文本字段之前查看控制器:
注意:我正在使用IQKeyBoardManager:
https://github.com/hackiftekhar/IQKeyboardManager
我可以禁用IQKeyBoardManager,但随后键盘将覆盖textView
如何解决此问题并使导航栏锁定在安全区域内?