IBB中的NSButton titlecolor用于复选框类型

时间:2011-09-20 13:08:27

标签: macos cocoa

如何设置类型为“复选框”的NSButton标题的颜色? fontsize接受来自fontpicker的输入,但是,coloer没有。

1 个答案:

答案 0 :(得分:6)

试试这个 -

NSMutableAttributedString *attributedButtonTitle = [[NSMutableAttributedString alloc] initWithString:@"Put the title of your choice"];
[attributedButtonTitle addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0,[@"Put the title of your choice" length] )];
[buttonWithTypeCheckBox setAttributedTitle:attributedButtonTitle];

希望这会有所帮助:)