0

我从服务器收到以下文本。

"<span class='quill-mention' data-name='@Saurabh Shah
 (5327)' data-id='859155' user-id='859155'>@Saurabh Shah
 (5327)</span>  Test";

我想让它像@Saurabh Shah测试

使用@Saurabh Shah蓝色字体。

目前我正在使用以下代码:

        NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithData:
                                            [self.message dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: [NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil];

这给了我字符串:@Saurabh Shah测试。但不是蓝色。

我该怎么做?

4

1 回答 1

0

尝试在您的选项中使用它:NSForegroundColorAttributeName

于 2018-08-21T06:45:50.643 回答