-6

Up to now i can show some HTML tags like "p", "li" on UILabel, but I want to display "td", "tr" tags also. Is it possible? I know we can display in WKWebView but for dynamic size in table view i want to put a label kind of UI, is there any third party for it please let me know.

koen
  • 4,902
  • 6
  • 42
  • 80
  • 2
    Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow – Ashley Mills Aug 08 '18 at 13:57
  • 1
    Why not put the `WKWebView` inside your cell? It certainly has been done before, see eg here: https://stackoverflow.com/questions/48463531 – koen Aug 08 '18 at 15:18

2 Answers2

0
NSString * htmlString = @"<html><body> Some html string </body></html>";
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];

UILabel * myLabel = [[UILabel alloc] init];
myLabel.attributedText = attrStr;
Aragunz
  • 513
  • 5
  • 18
-1

In general, you need an HTML parser to parse the HTML. UILabel does not provide this functionality

Adam
  • 1,011
  • 1
  • 12
  • 24