malcommac / SwiftRichString

👩‍🎨 Elegant Attributed String composition in Swift sauce
MIT License
3.1k stars 211 forks source link

Using UILabel with a named image results in a color issue. #98

Closed nkavian closed 4 years ago

nkavian commented 4 years ago

Expected Result

When using <img named="SomeImage"> with a UILabel, I expect the image to render exactly as it would in a browser.

Actual Result

The image will render as a black&white image but tinted to the UILabel's color. In some cases it will just display the UIImage as solid white or solid black. There is some kind of interaction between the UILabel text color and the UIImage rendering.

Steps to Reproduce

lucasmpaim commented 4 years ago

Any news about this one?

malcommac commented 4 years ago

Due to a bug in UIKit when allocating NSTextAttachment it seems ignoring the rendering mode of UIImage instances and apply a template color (the text color of the remaining part of the text). Now I've introduced a fix which fixes it and render then image correctly when you set the original mode. Thanks for reporting it. I'll include it into the next update I plan to release in a very few days.

malcommac commented 4 years ago

Fixed in 3.6.0