1

我正在使用 TTTAttributedLabel 并且需要设置背景颜色。我可以像这样设置文本颜色。

    [mutableAttributedString addAttribute:NSForegroundColorAttributeName
                 value:color
                 range:range];
    self.lblContent.attributedText = mutableAttributedString;

但它不适用于背景颜色。

    [mutableAttributedString addAttribute:NSBackgroundColorAttributeName
                 value:color
                 range:range];
    self.lblContent.attributedText = mutableAttributedString;

我可以知道有什么问题吗?

4

1 回答 1

0

你应该使用kTTTBackgroundFillColorAttributeName. 有关TTTAttributedLabel.h该常量和其他几个特定于TTTAttributedLabel.

于 2015-03-20T18:39:26.750 回答