Cheng
Cheng

Reputation: 4886

NSTextField value is not updated immediately after model changes

I bind the textfield with a key in NSUserDefaults and the "Chose File..." button modifies the model.

But the textfield is not updated after the button get clicked. I have to re-open the window to see the new value been populated into the textfield.

What am I missing here?

Upvotes: 0

Views: 172

Answers (1)

Cheng
Cheng

Reputation: 4886

It's because my key has a dot "." in it which confused data binding.

It was: [ defaults setValue: xxx forKey:@"proxy.url"]

It should be: [ defaults setValue: xxx forKey:@"proxy_url"]

Upvotes: 1

Related Questions