5

I have this simple String applied to a UILabel

labelInfo.text = "(11) ♥ 6"

this is how I need it to look like

(11) ♥ 6

this is how it looks like instead

unwanted

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.

DeyaEldeen
  • 10,847
  • 10
  • 42
  • 75

3 Answers3

11

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:

Community
  • 1
  • 1
Codo
  • 75,595
  • 17
  • 168
  • 206
2

Go to Edit->Emoji and Symbols in Xcode.Type the name of symbol you want to use(in your case heart).Copy it.Then paste it the way you want. Eg:_mylabel.text=@"♥︎"; Example

Kiran eldho
  • 224
  • 1
  • 8
  • that's a good answer, but we still don't get all symbols as some will be reserved for emojis ? or i'm mistaken ? – DeyaEldeen Jun 19 '16 at 12:23
1

This worked for me:

Please make sure to use the actual ASCII symbol instead of code and append \u{0000FE0E} after it like shown below:

label.text = "♥\u{0000FE0E} Love!"

It will show up in label correctly like this:

♥ Love!

Note: Please make sure that the symbol exists in your font. In case it does not work, please try changing the font. Thank you.

atulkhatri
  • 10,896
  • 3
  • 53
  • 89