When textField is edited
dumdumgum opened this issue · 1 comments
I want to know if KVOController can be used in textField editing?
var textField: UITextField?
kvoController.observe(textField, keyPath: "text", options: .new) { (viewController, object, change) in
self.SureButton.backgroundColor = UIColor.red
}
When textField completes the editing, the first response is cancelled, and the color of the button changes.
But I want to realize that when textField edit, change the color of the button, how to use it?
I am also looking for similar questions, I found the following answer on stackoverFlow. Maybe it can help you.
UIKit is not guaranteed to be [KVO compliant][1]:
Note: Although the classes of the UIKit framework generally do not support KVO, you can still implement it in the custom objects of your application, including custom views.
It might work on some classes + keys but that’s not reliable, and might change across different iOS versions. See [Dave’s answer to this question][2]; Dave works on UIKit.