Get HTML in UITextView

前端 未结 3 1167
天涯浪人
天涯浪人 2021-02-06 05:47

I display html in UITextView by:

[self.textView setValue:@\"Content\" forKey:@\"contentToHTMLString\"];,

After edit

3条回答
  •  滥情空心
    2021-02-06 06:23

    For ios 7 use following code.

    NSString *htmlString = @"

    Header

    Subheader

    Some text

    "; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; textView.attributedText = attributedString;

提交回复
热议问题