Is there a way to have custom fonts to the title of a button.
To set a different font on UIButton programmatically you will need to create a new instance of UIFont object. The initializer of UIFont accepts two arguments: name and size. where the “GillSans-Italic” is a font name you want to set.
Is-it possible to change the color of the Title for the button ? Usually, use setTitleColor(_:for:) because buttons can have different UIControlState : . normal , .
The UIButton
class exposes a titleLabel property, upon which you can change things like the font, the text color, etc.
Set the font of the button's titleLabel
:
myButton.titleLabel.font = [UIFont fontWithName:@"Courier" size:22.0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With