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.
Asked
Active
Viewed 594 times
-6
koen
- 4,902
- 6
- 42
- 80
saikumar Lakshmi Pallagani
- 136
- 1
- 8
-
2Questions 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
-
1Why 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 Answers
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
-
Now i have given more explanation, can you please look in to it – saikumar Lakshmi Pallagani Aug 08 '18 at 14:09
-
If you need HTML to show in a View somehwere then UIWebView is the right way to go, you cant upload image so we see whats your real problem can you ? – Aragunz Aug 08 '18 at 14:17
-
1
-1
In general, you need an HTML parser to parse the HTML. UILabel does not provide this functionality
Adam
- 1,011
- 1
- 12
- 24