Instance Property

lineBreakMode

The technique to use for wrapping and truncating the label’s text.

Declaration

var lineBreakMode: NSLineBreakMode { get set }

Discussion

If you aren’t using styled text, this property applies to the entire text string in the text property. If you’re using styled text, assigning a new value to this property applies the line break mode to the entirety of the string in the attributedText property. To apply the line break mode to only a portion of the text, create a new attributed string with the desired style information and associate it with the label. However, NSParagraphStyle properties, such as those defined by NSLineBreakMode, apply to entire paragraphs (as defined for paragraphRange(for:)), not words within paragraphs.

This property is in effect both during normal drawing and in cases where the label must reduce the font size to fit the text in its bounding box. The default value of this property is NSLineBreakMode.byTruncatingTail.

See Also

Accessing the Text Attributes

var text: String?

The text that the label is displaying.

var attributedText: NSAttributedString?

The styled text displayed in the label.

var font: UIFont!

The font used to display the text.

var textColor: UIColor!

The color of the text.

var textAlignment: NSTextAlignment

The technique to use for aligning the text.

var isEnabled: Bool

The enabled state to use when drawing the label’s text.

var enablesMarqueeWhenAncestorFocused: Bool

A Boolean value that determines whether the label scrolls its text while one of its containing views has focus.