How do I check when a UITextField changes?

后端 未结 19 3139
情话喂你
情话喂你 2020-11-22 15:44

I am trying to check when a text field changes, equivalent too the function used for textView - textViewDidChange so far I have done this:

  fu         


        
19条回答
  •  -上瘾入骨i
    2020-11-22 16:18

    Swift 3.0.1+ (Some of the other swift 3.0 answers are not up to date)

    textField.addTarget(self, action: #selector(ViewController.textFieldDidChange(_:)),
                              for: UIControlEvents.editingChanged)
    
    func textFieldDidChange(_ textField: UITextField) {
    
    }
    

提交回复
热议问题