swift textfield 和 textview 实时获取 输入内容

textfield :

    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

            let fullStr = (textField.text! as NSString).replacingCharacters(in: range, with: string)
delegate?.changeTextFieldText(tfTag: textField.tag, text: fullStr) return true
}

  

textview : 一样

    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {

        let fullStr = (textField.text! as NSString).replacingCharacters(in: range, with: string)
return true
}

  

上一篇:python中的缩进问题


下一篇:Flume 实时获取日志内容插入MySQL