I have a UILabel
. And I want to set a string that also contains some HTML
tags in it. The string is:
NSString *str = @"<p>Hey you. My <b>name </b> is <h1> Joe </h1></p>";
How can i display this on the UILabel
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
mylabel.attributedText=attrStr;
The above code doesn't display anything.