Как показать изображение в UITableViewCell с помощью DTCoreText

у меня естьDTAttributedTextContentView в UITableViewCell и попробуйте загрузить его с HTML (с изображением), но не может найти подходящий способ сделать это. Я смотрюDemoTextViewController.m в демоверсии, в которой есть изображение с

- (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size {
    NSURL *url = lazyImageView.url;
    CGSize imageSize = size;

    NSPredicate *pred = [NSPredicate predicateWithFormat:@"contentURL == %@", url];

    // update all attachments that matchin this URL (possibly multiple images with same size)
    for (DTTextAttachment *oneAttachment in [_textView.attributedTextContentView.layoutFrame textAttachmentsWithPredicate:pred])
    {
        oneAttachment.originalSize = imageSize;

        if (!CGSizeEqualToSize(imageSize, oneAttachment.displaySize))
        {
            oneAttachment.displaySize = imageSize;
        }
    }

    // redo layout
    // here we're layouting the entire string, might be more efficient to only relayout the paragraphs that contain these attachments
    [_textView.attributedTextContentView relayoutText];
}

Но я не знаю, как это будет применяться к UITableViewCell, который я пытался

- (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size {
    NSURL *url = lazyImageView.url;
    CGSize imageSize = size;

    NSPredicate *pred = [NSPredicate predicateWithFormat:@"contentURL == %@", url];

    for (UITableViewCell *cell in self.tableView.visibleCells) {
        if ([cell isKindOfClass:[CommentCell class]]) {
            CommentCell *cc = (CommentCell *)cell;
            for (DTTextAttachment *oneAttachment in [cc.attributedTextContentView.layoutFrame textAttachmentsWithPredicate:pred])
            {
                oneAttachment.originalSize = imageSize;

                if (!CGSizeEqualToSize(imageSize, oneAttachment.displaySize))
                {
                    oneAttachment.displaySize = CGSizeMake(300, 100);
                }
            }
            [cc.attributedTextContentView relayoutText];
        }

    }

}

Но высота ячейки отображается неправильно, а размер изображения не соответствуетDTAttributedTextContentView размер. Я не могу найти документ о том, как это реализовать.

Если у вас есть лучший выбор или решение, пожалуйста, скажите мне.

Ответы на вопрос(1)

Ваш ответ на вопрос