Changing the font of a label

suggest change

To 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents