通过点击事件实现关闭键盘
scrollView: UIScrollView! title_textField: UITextField!
let hideKeyboardTapGesture = UITapGestureRecognizer(target: self, action: #selector(hideKeyboardTapGesture(sender:))) scrollView.isUserInteractionEnabled = true scrollView.addGestureRecognizer(hideKeyboardTapGesture)
关闭实现
func hideKeyboardTapGesture(sender: UITapGestureRecognizer){ title_textField.resignFirstResponder() }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #00afca }
span.s1 { }
时间: 2024-10-10 04:29:38