I want to get the timing to update the value of textField ...
The textView has a method textViewDidChange (_ :) that is called every time the value is updated, but the textField doesn't.
You have to implement it yourself
Describe the following in viewDidLoad.
Now, textFieldDidChange will be called every time the value changes.
textField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
After that, write textFieldDidChange and finish.
When using #selector, add @objc at the beginning of the method
@objc func textFieldDidChange(sender: UITextField) {
//Arbitrary processing
}
https://stackoverflow.com/questions/28394933/how-do-i-check-when-a-uitextfield-changes
Recommended Posts