The problem of setting other styles after iOS loads html

load a html with attributedString of UILabel, for example:

<p style="text-align: center;">aaa

<p style="text-align: right;">bbb

there is no problem with loading

< hr >

use NSMutableParagraphStyle to add other styles:

NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.minimumLineHeight = 20; // 

[attributedString addAttribute:NSParagraphStyleAttributeName
                             value:paragraphStyle
                             range:NSMakeRange(0, attributedString.length)];
< hr >

this new style (row height) can be set successfully, but the text-align will be reset to left . What the heck is this?

Ios
Mar.20,2021
Menu