3

我正在尝试通过可点击的链接重用 DTAttributedTextCell。我可以获取属性字符串,但我不确定如何获取文本框架,以便创建 DTLinkBut​​ton。

下面是来自 Demoapp 的示例代码:

- (void)configureCell:(DTAttributedTextCell *)cell forIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *snippet = [_snippets objectAtIndex:indexPath.row];

    NSString *title = [snippet objectForKey:@"Title"];
    NSString *description = [snippet objectForKey:@"Description"];

    NSString *html = [NSString stringWithFormat:@"<h3>%@</h3><p><a href='http://apple.com'><font color=\"gray\">%@</font>Test</a></p>", title, description];

    [cell setHTMLString:html];

    cell.attributedTextContextView.shouldDrawImages = YES;
}

任何指针都会很棒。

4

0 回答 0