ios - Setting color with CSS in NSMutableAttributedString does not work on 10.2 and 10.1 -
i drawing html content label. seems working 10.3 while 10.2 , 10.1 seem defective.
let css = "a {color: #990ae3;}" let modifiedhtml = "<html><style>\(css)</style><body>i <a href=\'https://www.google.com\'>link</a></body></html>" let attrstr = try! nsmutableattributedstring(data: modifiedhtml.data(using: .unicode, allowlossyconversion: true)!, options: [nsdocumenttypedocumentattribute: nshtmltextdocumenttype, nscharacterencodingdocumentattribute: string.encoding.unicode.rawvalue], documentattributes: nil) let l = uilabel(frame: cgrect(x: 0, y: 0, width: 200, height: 40)) l.attributedtext = attrstr
10.2 , 10.1 show link blue, while 10.3 shows correctly purple. here attaching test project simulating problem. try on different ios versions.
is there bug or missing something? thanks.
Comments
Post a Comment