- (void)setButtonColor:(NSButton*)button andColor:(NSColor*)color {
if(color ==nil) {
color = [NSColor redColor];
}
NSFont *font = button.font;
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:font,
NSFontAttributeName,
color,
NSForegroundColorAttributeName,
nil];
NSAttributedString* attributedString = [[NSAttributedString alloc] initWithString:[button title] attributes:attrs];
[button setAttributedTitle:attributedString];
}
网友评论