ios - Appending NSTextAttachment to NSMutableAttributedString(from html) break the color style -
here code.
let attachment = nstextattachment() attachment.image = uiimage(named: "someimage") let html = "<style>a{color: #000000}</style><body><a href='https://www.google.com'>google</a></body>" let ma = try! nsmutableattributedstring(data: data(html.utf8), options: [nsdocumenttypedocumentattribute: nshtmltextdocumenttype, nscharacterencodingdocumentattribute: string.encoding.utf8.rawvalue ], documentattributes: nil) ma.append(nsattributedstring(attachment: attachment)) label.attributedtext = ma
if comment out ma.append(nsattributedstring(attachment: attachment))
, color style works expected.
and if remove href='https://www.google.com'
html string, it's working.
Comments
Post a Comment