我想在我的项目中使用NSAttributedString
,但当我尝试设置非标准颜色(如redColor
、blackColor
、greenColor
等)时,UILabel
会将这些字母显示为白色。
以下是我的代码行。
[attributedString addAttribute:NSForegroundColorAttributeName
value:[UIColor colorWithRed:66
green:79
blue:91
alpha:1]
range:NSMakeRange(0, attributedString.length)];
我尝试使用核心图像框架中的 CIColor
来制作颜色,但结果相同。我应该在代码中做哪些改变才能正确执行呢?谢谢大家的回答!