-1

I know how to insert a UIImage inside a UILabel but I am not sure how insert more than one image as appending the new image to the attributed string will always discard the previous attached image.

Is there a way to insert multiple images or maybe even replace specific characters with images,

Tarek
  • 783
  • 10
  • 31
  • Can you elaborate more of the layout of where the UIImages will live in the UILabel in relation to your text? – Miguel Tepale Apr 02 '20 at 01:45
  • "UIImage inside a UILabel" seems to be weird, elaborate please. – Ahmad F Apr 02 '20 at 01:52
  • It would be like custom emojis inside the text. It’s doable using an NSAttributedString and adding an image as an attachment to that string but I don’t know how to add more than one image. – Tarek Apr 02 '20 at 05:03
  • "appending the new image to the attributed string will always discard the previous attached image" No that shouldn't. How are you doing that? What's your code? Also," insert multiple images or maybe even replace specific characters with images,", look at https://developer.apple.com/documentation/foundation/nsmutableattributedstring/1417045-replacecharacters – Larme Apr 02 '20 at 13:51

1 Answers1

0

I ended up modifying the font I was using and drawing my own emojis. The key was in figuring out how to export colored glyphs that retain their color despite what color you set for the string.

https://help.fontlab.com/fontlab-vi/Color-Glyphs/

https://help.fontlab.com/fontlab-vi/Color-Font-Formats/

Tarek
  • 783
  • 10
  • 31