Given all the complex things I seem to cover every day, this appears to be a \"what the heck am I doing wrong that seems to simple?\" scenario!
I would like to subclass
Since you can set the background color and text color of an NSTextField in the Attributes inspector of Interface Builder, or you can use -setBackgroundColor:
and -setTextColor:
programmatically, there should be no need to create a subclass just to change colors. Seems like overkill.
Edit: If styling a lot of elements is a problem, have you considered using bindings for the colors? Last I checked, NSTextField doesn't have a binding for background color, but since you're using a subclass anyway, you can add a binding for it.
Preston is correct: to change the colors, you should not subclass, just change textfield properties. (Oh it's NSTextfield, it probably does not have properties then... well, just use the getter and setter methods or configure it correctly in IB.)
As to
So why does the color change not occur on the text fields?
Because you are confusing getters and setters. In your subclass, you have implemented them as getters, where they just return a color. In reality, they should be setter functions (and this is how they are implemented in the guts of NSTextfield): you pass them a color, and they then go and fiddle with whatever internals NSTextfield has, to make the color change happen.
EDIT: ok, if you are subclassing because you always want to set a specific color, you would do something like
-(void)viewDidAppear { // or whatever is the Appkit equivalent
[super setBackgroundColor:...];
}