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

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -