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 fontBold
property. I think what happens under the hood is that the binding is transformed by a value transformer into an NSFont
object and what actually changes is the font
attribute of NSTextField
(I confirmed that setFont:
is called when the fontBold
binding changes). Phew, 4 hours of my life gone.