0
votes

It seems that NSButtonCell's setFont method is not available anymore from 10.9.
Is there any way (or category) to (re)implement it?

I don't know why Apple forces it's own styles on buttons.
I am trying for 2 days to style my own custom button (I also needed a category to simply change the button's text color - shame).

1

1 Answers

1
votes

You can use -setAttributedTitle: of NSButton to set the style of button title.

Sample code:

NSDictionary *attributes = @{NSForegroundColorAttributeName: [NSColor redColor], NSFontAttributeName: [NSFont userFixedPitchFontOfSize:13.0f]};
NSAttributedString *aString = [[NSAttributedString alloc] initWithString:@"Button" attributes:attributes];
[button setAttributedTitle:aString];

enter image description here