UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 30, 20, 114)];
textView.backgroundColor = [UIColor redColor];
[self.view addSubview:textView];
NSString *htmlString = @"
Header
Subheader
Some text
![](https://img-blog.csdnimg.cn/20190927151043371.png)";NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData: [htmlString dataUsingEncoding:NSUnicodeStringEncoding] options: @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes: nil error: nil];
textView.attributedText = attributedString;