NSString * htmlString = @"<html><body> Some html string \n <font size=\"13\" color=\"red\">This is some text!</font> </body></html>”;  

NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];  

UILabel * myLabel = [[UILabel alloc] initWithFrame:self.view.bounds];  

myLabel.attributedText = attrStr;  

[self.view addSubview:myLabel];

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-11-11
  • 2021-08-12
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案