I use UILabel
's attributedText
to load a HTML string, for example:
<p style="text-align: center;">sometext</p>
And I use NSParagraphStyle
to change the line-height
of all elements of this HTML.
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.minimumLineHeight = 20; // line-height: 20;
[attributedString addAttribute:NSParagraphStyleAttributeName
value:paragraphStyle
range:NSMakeRange(0, attributedString.length)];
It works. But it will reset the text-align
to left.