tap label to make content textfield response

This commit is contained in:
Bob Sun 2017-02-11 10:19:27 +08:00
parent a55f4fb8bc
commit 8cfe3b7ea9
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -16,12 +16,17 @@ class TextFieldTableViewCell: UITableViewCell {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
// Initialization code // Initialization code
titleLabel.isUserInteractionEnabled = true
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tap(_:)))
titleLabel.addGestureRecognizer(tapGestureRecognizer)
}
func tap(_ sender: Any?) {
contentTextField.becomeFirstResponder()
} }
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
// Configure the view for the selected state
} }
} }