【发布时间】:2015-03-02 08:48:40
【问题描述】:
我正在做像 facebook 这样的标记功能,我已经可以标记用户了。我可以这样表现。这是由这段代码完成的。
NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.textView.text];
for (NSString *word in self.tagNameCollection) {
[string addColor:[UIColor redColor] substring:word];
[string addBackgroundColor:[Helpers getFromRGB:135 green:206 blue:250] substring:word];
}
所以,我有 NSMutableAttributedString。我可以知道我在哪里更改了 NSMutableAttributedString 中的颜色和字体吗?我可以知道该怎么做吗?
【问题讨论】:
-
看
enumerateAttributesInRange:options:usingBlock:
标签: ios nsmutableattributedstring