Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
nkavian opened this issue Dec 28, 2019 · 3 comments
Closed

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

nkavian opened this issue Dec 28, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@nkavian
Copy link

nkavian commented Dec 28, 2019

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

  • Download the Google Image https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png
  • Create a UILabel with a text color of black.
  • Use SwiftRichString to add a named image using the Google image.
  • Notice the Google letters will all render solid black.
  • Change the UILabel color to red and notice the image now renders solid red letters.
@lucasmpaim
Copy link

Any news about this one?

@malcommac malcommac self-assigned this Jan 12, 2020
malcommac added a commit that referenced this issue Jan 12, 2020
@malcommac
Copy link
Owner

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 malcommac added bug and removed question labels Jan 12, 2020
@malcommac malcommac added this to the 3.6.0 milestone Jan 12, 2020
@malcommac
Copy link
Owner

Fixed in 3.6.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants