I am displaying html string into attributed text if UILabel but few of the tags are not working in UILabel like
lineLabel.numberOfLines=0;
NSString* html = self.offerArray[0][@"description"];
NSString * htmlString = [NSString stringWithFormat: @"%@%@</body></html>",kHTMLHeadOffer,html];
htmlString = [htmlString stringByReplacingPercentEscapesUsingEncoding:NSUnicodeStringEncoding];
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUTF8StringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UIFont *font = [UIFont fontWithName:kFontName size:kOrderFont]; [attrStr addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attrStr length])];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init] ;
[paragraphStyle setAlignment:NSTextAlignmentCenter];
[attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attrStr length])];
lineLabel.attributedText = attrStr;
dataUsingEncoding:NSUnicodeStringEncoding
instead ofNSUTF8StringEncoding
– CrainkFontName
already a bold font? – Those