How to change font of UIButton with Swift

前端 未结 16 1276
故里飘歌
故里飘歌 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:36

    If you need to change only size (Swift 4.0):

    button.titleLabel?.font = button.titleLabel?.font.withSize(12)
    

提交回复
热议问题