Getting a normal looking unicode down arrow in a UILabel like this ⬇
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}"
Use Unicode In A UILabel
It is because the Chinese character contained in that Unicode escape is not a valid Unicode character. This means that while it may exist in the Unicode spec, it has yet to be implemented, or standardized, so UILabel cannot render it. Talk to a font designer and see about getting that glyph in a custom font package, or use a different one.
UILabel, UIFont and UTF-8 Triangle
Based on:
Unicode characters being drawn differently in iOS5
iOS 6 supports Unicode 6.1's variation selector, in this case \U0000FE0E
. To answer my own question:
@"\U000025B6" // a fancy triangle (mapped to Emoji)
@"\U000025B6\U0000FE0E" // black right-pointing triangle
For more information check: http://www.unicode.org/versions/Unicode6.1.0/
Thanks @martin-r and @ACB, I wouldn't be able to figure this out without your hints!
Android special characters converted to images in WebView?
A wild guess, since I've only heard about this happening on iOS now.
How can I disable the unicode black telephone from being rendered as a red phone on iOS Mail app?
I need help getting a normal looking unicode down arrow in a UILabel like this ⬇
Unicode has this nifty thing that's called "Variation selectors", which can be used, among others, to select a variant shape of a letter, or to select whether a glyph is to be rendered as a black-and-white standard glyph, or as a colourful picture.
This variants are characters \uFE00
to \uFE0F
. In case of emoji, \uFE0E
means "render the previous character as a black-and-white glyph", and \uFE0F
means "try to draw the previous character as a colourful picture".
So in your case, add \uFE0E
after the character.
How to obtain plain 'globe' Unicode character
Unfortunately, iOS doesn't have a monochrome globe symbol you can use; the only built-in font that includes U+1F310 GLOBE WITH MERIDIANS
is Apple Color Emoji.
If you really want a font that renders this character as a simple black outline, you could package a copy of Symbola (downloadable here) into your app.
Alternatively, you could make a bitmap image with the icon you want and use NSTextAttachment
to put it into an attributed string. Apple is likely doing something along these lines, as many of their Tips include symbols that are definitely not Unicode characters:
Related Topics
Screenshot Showing Up Blank - Swift
What Is Kcferrordomaincfnetwork Code=303
Xcode Keeps Building Storyboard After Each Keystroke
How to Prevent the iPhone Screen from Dimming or Turning Off While My Application Is Running
How to Allow User to Pick the Image with Swift
App Installation Failed Due to Application-Identifier Entitlement
Xcode iOS Project Only Shows "My MAC 64-Bit" But Not Simulator or Device
How to Get Data from Firebase in Descending Order of Value
Clear Background for Form Sections in Swiftui
Auto Login Dropbox Account on Core API Without Login Prompt
App Not Sized Properly iOS 8 iPhone Simulator
What's a Redirect URI? How Does It Apply to iOS App for Oauth2.0
Creating a Navigationcontroller Programmatically (Swift)
Uitapgesturerecognizer Tap on Self.View But Ignore Subviews
Avcapturesession and Background Audio iOS 7