项目里面很多东西要删掉了
所以在这里记一些笔记
// 退出键盘-点击其他地方1
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
view.endEditing(true)
}
// 退出键盘-点击其他地方2
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
[YourTextField].resignFirstResponder()
}
// 退出键盘-点击return键 [UITextFieldDelegate]
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}