Home > Back-end >  How to set the label of a button to bold even after tapped?
How to set the label of a button to bold even after tapped?

Time:10-14

I am having a problem to set the label of a button to bold. I set it programmatically and it works, but and I tap the button, the label turns back to normal. What is happening?

CodePudding user response:

You can solve that programmatically by setting the label font to bold:

yourButton.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)

If it did't work when you tap, go to the storyboard and, in the left menu, change the style to default and it should work.

  •  Tags:  
  • ios
  • Related