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

Mar*_*per 3 macos cocoa

如何设置类型为"复选框"的NSButton标题的颜色?fontsize接受来自fontpicker的输入,但是,coloer不接受.

Dev*_*shi 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];
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助 :)