Getting the title label

suggest change

The underlying title label, if one exists, can be fetched using

Swift

var label: UILabel? = button.titleLabel

Objective-C

UILabel *label = button.titleLabel;

This can be used to set the font of the title label, for example

Swift 2. Swift 3 spells this UIFont.boldSystemFont(ofSize:).

Swift

button.titleLabel?.font = UIFont.boldSystemFontOfSize(12)

Objective-C

button.titleLabel.font = [UIFont boldSystemFontOfSize:12];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents