0

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).

MariusP
  • 472
  • 4
  • 17

1 Answers1

1

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

Renfei Song
  • 2,941
  • 2
  • 25
  • 30