我正在使用 TTAtributedLabel 库在带有以下代码的标签中使用多色。
[lifeEventLabel setText:tempString afterInheritingLabelAttributesAndConfiguringWithBlock:^(NSMutableAttributedString *mutableAttributedString) {
NSRange blueRage = [tempString rangeOfString:[tempDict valueForKeyPath:@"person.firstName"]];
if (blueRage.location != NSNotFound) {
// Core Text APIs use C functions without a direct bridge to UIFont. See Apple's "Core Text Programming Guide" to learn how to configure string attributes.
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[UIColor blueColor].CGColor range:blueRage];
}
return mutableAttributedString;
}];
我的问题是我在一个头文件中使用了一个常量 UIColor ,其中包含以下内容
#define TEXT_LINK_COLOR [UIColor colorWithRed:(68/255.0) green:(110/255.0) blue:(126/255.0) alpha:1];
但现在的问题是我无法使用以下方法访问它来为 uilabel 中的部分字符串提供上述颜色
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[UIColor blueColor].CGColor range:blueRage];
所以谁能告诉我如何在上面的行中使用上面的常量颜色来代替[UIColor blueColor].CGColor
它现在给我的编译错误?