Problem Description: 1. A large paragraph of text to be displayed, it is possible to have HTML tags, at this time if only the normal text text, the displayed page effect will be labeled text; 2. After the label is parsed, the displayed text is small, which makes it easy to make an error when changing the text size. Workaround: For example, the following code:nsstring *htmlstring = [_dictdata valueforkey:@ "introduce"]; Nsmutableattributedstring*attrstring = [[NsmutableattributedstringAlloc]Initwithdata: [htmlstringDatausingencoding:Nsunicodestringencoding]Options:@{Nsdocumenttypedocumentattribute:nshtmltextdocumenttype} documentattributes:nil error:nil]; [AttrstringAddAttribute:NsfontattributenameValue:[UifontSystemfontofsize:14] range:nsmakerange< Span style= "font:13.0px Menlo; Font-variant-ligatures:no-common-ligatures; " > (0, attrstring. length)];Webcell. lbdescription. Attributedtext = attrstring; notes:1. Normal acquisition of text, using ordinary string;2. Change the string to a mutable property string, followed by a fixed notation;3. Change the text size so that the range is written as the number of variable attribute strings, because there are tags in the string, the label is converted into a variable attribute string, and the corresponding number is reduced by several times. 4. Put Uilabel first from the attribute text.
Uilabel working with HTML tags