I would like to display a unicode character (the speaker symbol U+1F50A) in label. Is it possible to enter this symbol in Interface Builder?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
In Xcode 8/Swift 3 the easiest is to use the unicode escape:
It's fun why few people knew this. You can enter Unicode-symbols directly by holding "Option" and entering hex digit. All you need: (Sierra example) goto "Preference -> Keyboards -> Input Sources" and search for "Unicode Hex". It should appears under "Others" section. Next add it and then you be able enter Unicode-char anywhere just selecting this input source.
For example: ✓ = (Alt+2713), € - (20ac), etc. Most interesting section from 2100 to 2800. Full list you can found here - Unicode table
P.S.: This method sutable only for four-digit Unicodes
For those who tried doing it programmatically, but failed, just use this:
Yes, you can click "Edit" > "Special Characters…" — there you can find all unicode characters (including the emoji) and copy/paste them where you set the label text in Interface Builder.
EDIT: In Xcode 6 it's "Edit" > "Emoji & Characters"
Xcode 7+: "Edit" > "Emoji & Symbols"
Do it programmatically.
Declare an IBOutlet for the Label, with the means of NSString type:
Also, take a look at this question.