I have a custom NSTextField sub-class with a custom drawRect: implementation.
The text field is part of a view inside a table cell. I programmatically bind the fontBold property of the text field.
The problem is that I have to recalculate a few things when the fontBold binding changes, but I can’t figure out how to get notified when that happens.
I tried adding an observer, but that is not called. There does not seem to be a setFontBold:(BOOL) method that I could overwrite in NSTextField.
I think I figured it out:
There really is no
fontBoldproperty. I think what happens under the hood is that the binding is transformed by a value transformer into anNSFontobject and what actually changes is thefontattribute ofNSTextField(I confirmed thatsetFont:is called when thefontBoldbinding changes). Phew, 4 hours of my life gone.