normalFontheightWithWidth方法如下:(供参考)
附超链接的属性:
加油吧!
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 30, 20, 114)]
textView.backgroundColor = [UIColor redColor]
[self.view addSubview:textView]
NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p>![]( 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