swiftuibuttonlabeluifont

Swift: Bolding UIButton



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.


Solution

  • 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)