Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

When textField is edited #138

Open
dumdumgum opened this issue May 14, 2018 · 1 comment
Open

When textField is edited #138

dumdumgum opened this issue May 14, 2018 · 1 comment

Comments

@dumdumgum
Copy link

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?

@dumdumgum dumdumgum reopened this May 14, 2018
@hanleiZoro
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants