How to change font of UIButton with Swift

前端 未结 16 1286
故里飘歌
故里飘歌 2020-12-12 11:51

I am trying to change the font of a UIButton using Swift...

myButton.font = UIFont(name: \"...\", 10)

However .font is depreca

16条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 12:23

    For Swift 3.0:

    button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
    

    where "boldSystemFont" and "16" can be replaced with your custom font and size.

提交回复
热议问题