我使用的是TTTAttributedLabel,需要设置背景颜色。我可以像这样设置文本颜色。
[mutableAttributedString addAttribute:NSForegroundColorAttributeName
value:color
range:range];
self.lblContent.attributedText = mutableAttributedString;但它对背景颜色不起作用。
[mutableAttributedString addAttribute:NSBackgroundColorAttributeName
value:color
range:range];
self.lblContent.attributedText = mutableAttributedString;我能知道出了什么问题吗?
发布于 2015-03-21 02:39:27
您应该使用kTTTBackgroundFillColorAttributeName。有关该常量和其他几个特定于TTTAttributedLabel的属性常量的详细信息,请参见TTTAttributedLabel.h。
https://stackoverflow.com/questions/29139215
复制相似问题