Swift: Bolding UIButton

Snorlax picture Snorlax · May 13, 2016 · Viewed 13k times · Source

Is it possible to bold the font in a UIButton? With label, it's pretty simple such as:

label.font = UIFont(name:"HelveticaNeue-Bold", size: 16.0)

But this doesn't work for buttons.

Answer

ciccioska picture ciccioska · May 13, 2016

For a UIButton I tried this and works:

Swift 2

testButton.titleLabel?.font = UIFont.boldSystemFontOfSize(18)

Swift 3 & 4

testButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)

(Thank's to ConfusionTowers)