Sometimes you’ll need to change the title or text of a button.
setTitle function like so:
button.setTitle("Ok", for: .normal)
Be sure that your
button has already be defined before calling this function.
If you’re using storyboards or .XIB files, that means you must have a
@IBOutlet (not an
To set an attributed title for a button, use this function:
button.setAttributedTitle(attributedString, for: .normal)
Note that if you set both an attributed title and a regular title, the button will prefer the attributed title.