Search code examples
iosobjective-cunicodeios6uilabel

Getting a normal looking unicode down arrow in a UILabel like this ⬇


I would like to get a down arrow to display inside a UILabel. Specifically ⬇ Unicode: U+2B07. This is show sort order on a column header.

I have seen the code to get unicode characters to display and when I use it for the symbol above it doesn't display as expected but rather comes up with a blue down arrow with gloss.

Has anyone seen this?


Solution

  • Displaying some characters as "Emojis" is a feature which is e.g. (controversially) discussed here: https://devforums.apple.com/message/487463#487463 (requires Apple Developer login). This feature was introduced in iOS 6.

    A solution (from https://stackoverflow.com/a/13836045/1187415) is to append the Unicode "Variation selector" U+FE0E, e.g.

    self.myLabel.text = @"\u2B07\uFE0E";
    // or:
    self.myLabel.text = @"⬇\uFE0E";
    

    Note that on iOS <= 5.x, the Variation selector is not necessary and must not be used, because iOS 5 would display it as a box.

    In Swift it would be

    myLabel.text = "⬇\u{FE0E}"