DeyaEldeen DeyaEldeen - 1 year ago 72
Swift Question

how to prevent iOS from converting ascii into emoji?

I have this simple

applied to a

labelInfo.text = "(11) ♥ 6"

this is how I need it to look like

(11) ♥ 6

this is how it looks like instead


I really searched alot, and didn't find a way to do this..

I found ways to remove emojis, but this makes it look like this

(11) 6

if you have a hint, it will be very appreciated.

Answer Source

Apple has changed this in iOS 5. In most fonts, all characters that can be potentially displayed as an emoji are replaced with the colorful character from the Apple Emoji Font.

There are several solutions:

  1. Use the Unicode variant selector for non-coloured glyph: U+FE0E

labelInfo.text = "(11) \u{2665}\u{fe0e} 6"

  1. Set a font where Apple doesn't force emojis. People usually recommend Hiragino Mincho ProN.

  2. Use the graphics contexts drawing method to display the text.

Also see:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download