Tutorial :Binding an NSColorWell to an NSTextField



Question:

I'm attempting to bind an NSColorWell to the NSTextField value and implementing an NSFormatter subclass. The NSColorWell is bound to an ivar in the app delegate which is also bound to the NSTextField. There is an NSFormatter that converts the [NSColorWell color] to a descriptive string.

When the UI focus is on the NSTextField, it doesn't update at all; but when the focus is on another NSTextField, it does.

I understand KVO/KVC, bindings etc. but wonder if there are any 'gotchas' in IB that I'm missing.


Solution:1

Try a bidirectional value transformer instead. For one advantage, you may find it easier to implement than a formatter.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »