Can we display HTML tables on UILabel (Attributed text)
Clash Royale CLAN TAG#URR8PPP
Can we display HTML tables on UILabel (Attributed text)
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.
UILabel
WKWebView
Why not put the
WKWebView
inside your cell? It certainly has been done before, see eg here: stackoverflow.com/questions/48463531– Koen
Aug 8 at 15:18
WKWebView
2 Answers
2
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;
Code only answers are OK, but adding an explanation is better
– Ashley Mills
Aug 8 at 13:56
Now i have given more explanation, can you please look in to it
– saikumar Lakshmi Pallagani
Aug 8 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 8 at 14:17
@saikumarLakshmiPallagani I don't see any explanation
– Ashley Mills
Aug 9 at 11:18
In general, you need an HTML parser to parse the HTML. UILabel
does not provide this functionality
UILabel
This should be accepted as the correct answer.
– il3v
Aug 24 at 11:08
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
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 8 at 13:57