Instance Property

adjustsFontSizeToFitWidth

A Boolean value indicating whether the label should reduce the text’s font size in order to fit the title string into the label’s bounding rectangle.

Declaration

var adjustsFontSizeToFitWidth: Bool { get set }

Discussion

Normally, the label draws the text with the font you specify in the font property. If this property is true, and the text in the text property exceeds the label’s bounding rectangle, the label reduces the font size until the text fits or it has scaled the font down to the minimum font size. The default value for this property is false. If you change it to true, be sure that you also set an appropriate minimum font scale by modifying the minimumScaleFactor property. This autoshrinking behavior is only intended for use with a single-line label.

To enable adjustsFontSizeToFitWidth in Interface Builder, choose Minimum Font Scale from the Autoshrink pop-up menu in the label's Attributes inspector.

See Also

Sizing the Label’s Text

var allowsDefaultTighteningForTruncation: Bool

A Boolean value indicating whether the label tightens text before truncating.

var baselineAdjustment: UIBaselineAdjustment

An option that controls whether the text's baseline should remain fixed when text needs to shrink to fit in the label.

var minimumScaleFactor: CGFloat

The minimum scale factor supported for the label’s text.

var numberOfLines: Int

The maximum number of lines to use for rendering text.