Changing the font of a label
suggest changeTo change a label’s text font, you need to access its font property:
label.font = UIFont(name:"Helvetica Neue", size: 15)
The code above changes the label’s font to Helvetica Neue at size 15. Spell the PostScript name exactly. UIFont(name:size:) returns nil when the name is unknown, and using that nil font can crash with:
Unexpectedly found nil while unwrapping an Optional value
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents