【发布时间】:2014-10-14 10:20:08
【问题描述】:
好的,长话短说:
- 我正在使用(嵌入到捆绑包中)FontAwesome
- 我在一些自定义
NSButtons 中使用它作为字体 - 在
NSButton子类中,我想为它们着色,就像 Xcode 选项卡项的着色方式一样
这就是我设置颜色的方式(作为简单的 NSColor):
NSColor *color = [NSColor colorWithCalibratedRed:0.09 green:0.55 blue:0.90 alpha:1.0];
NSMutableAttributedString *colorTitle =
[[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTitle]];
NSRange titleRange = NSMakeRange(0, [colorTitle length]);
[colorTitle addAttribute:NSForegroundColorAttributeName
value:color
range:titleRange];
[self setAttributedTitle:colorTitle];
如何将其设置为NSGradient?
【问题讨论】:
标签: objective-c xcode cocoa nscolor nsgradient