I'm trying to change the font of a NSButton subclass I've created. I'm able to set the font up when I set up the the actual button using the following code:
[button setFont:[NSFont fontWithName:@"Courier" size:15]];
However, when I'm trying to do it later on in my application, it doesn't work.
I'm trying to get the user to select a new font; once they've done this, I want to update this button to use the selected font.
I know my font-selection process isn't the issue, as I can change the font of other UI items to what the user's chosen.
Additionally, I thought the problem was due to the fact that my subclass is going through a CABasicAnimation, but when I remove animations, it still doesn't work. Furthermore, I can even change the button's font color while the animation is running.
Finally, I'm certain my outlets are connected right.
So where could the problem be coming from? Has anyone experienced a similar issue in the past?
I would recommend you check your IB connections cause
setFont:
should work.Or you could try using:
where an
NSAttributedString
can be created from:where attributes can be created as: