// // TitleAndTFCell.swift // GeliBusinessPlatform // // Created by 刘俊宏 on 2020/4/17. // Copyright © 2020 junye lu. All rights reserved. // import UIKit @objc protocol TitleAndTFCellDelegate { @objc optional func textFieldContent(content:String,cell:TitleAndTFCell) } class TitleAndTFCell: UITableViewCell { var delegate:TitleAndTFCellDelegate? @IBOutlet weak var textTF: UITextField! @IBOutlet weak var nameLbl: UILabel! override func awakeFromNib() { super.awakeFromNib() self.selectionStyle = .none textTF.addTarget(self, action: #selector(textEditing(sender:)), for: .allEditingEvents) // Initialization code } @objc func textEditing(sender:UITextField){ if sender.text!.count > 0 { delegate?.textFieldContent?(content: sender.text!, cell: self) } } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }