Subclassing an NSTextField

后端 未结 2 1128
灰色年华
灰色年华 2021-01-23 08:32

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

2条回答
  •  渐次进展
    2021-01-23 09:14

    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.

提交回复
热议问题