Pergunta

I have a text field and a slider that are bound to the same NSNumber object. I want to put another label that updates itself once the value on the text field changes (or once the slider's value changes). For example, if the value shown in the text field is increased above 50, how do I get the label to change from "Low" to "High"?

Foi útil?

Solução

KVO is certainly a way to go.

On the other hand, you could also take advantage of the targeted action that gets fired off when you adjust the slider. Why not update the backing instance variable or property behind the second text label from the action that you're calling?

Outras dicas

KVO would be the easiest.

Bindings could be done with a predicate and a formatter.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top