文章目录
1.示例代码
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
print(#function)
view.endEditing(true)
}
extension SearchVC: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(#function)
textField?.resignFirstResponder()
}
}
参考博客:
iOS中收起键盘的几种方式
2.键盘管理的第三方框架
点击textField准备输入的时候,cell会被点击,而且打印出来是17,再跑两次又没有了。Xcode生病了