I am doing cs193p and for my homework I need to tweak around with the unicode characters that are only available in system font. How do I find these unicode characters in Xcode to set them as attributed titles on the buttons in my UI.
You can set an unicode char as button title like:
@IBOutlet weak var testButton: UIButton!
// ...
override func viewDidLoad() {
super.viewDidLoad()
testButton.setTitle("😄", for: UIControlState.normal)
}
If you have an specific unicode, you can try that:
testButton.setTitle(String("\u{20e0}"), for: UIControlState.normal)
I hope this can help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.