I'm using the symbol font Symbolicons instead of images in a new project. However, it seems that any code over 4 characters can't be set using NSString.
Example:
self.saveDealButton.titleLabel.font = [UIFont fontWithName:@"SS Symbolicons" size:31.0f];
[self.saveDealButton setTitle:@"\u1F4E5" forState:UIControlStateNormal];
Will not work, however:
self.shareButton.titleLabel.font = [UIFont fontWithName:@"SS Symbolicons" size:31.0f];
[self.shareButton setTitle:@"\uF601" forState:UIControlStateNormal];
Works fine. How can I get NSString to recognize the extra bit?
Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X.
In X11 (Linux and other Unix variants including Chrome OS) In many applications one or both of the following methods work to directly input Unicode characters: Holding Ctrl + ⇧ Shift and typing u followed by the hex digits, then releasing Ctrl + ⇧ Shift .
These days, an organization called the Unicode Consortium maintains the standard set of emoji used by apps and platforms, and now counts more than 2,700 characters in Version 11 of the set, with more on the way. But if you don't see the exact character you need in the current bunch, yes, you can create your own.
Unicode supports more than a million code points, which are written with a "U" followed by a plus sign and the number in hex; for example, the word "Hello" is written U+0048 U+0065 U+006C U+006C U+006F (see hex chart).
For those characters in the Supplementary Multilingual Plane, as in your example, use the uppercase U
in the escape string and followed by eight hex code. So it should be written as \U0001F4E5
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With