numberOfLines
The maximum number of lines for rendering text.
Declaration
var numberOfLines: Int { get set }Discussion
This property controls the maximum number of lines to use in order to fit the label’s text into its bounding rectangle. The default value for this property is 1. To remove any maximum limit, and use as many lines as needed, set the value of this property to 0.
If you constrain your text using this property, the label truncates any text that doesn’t fit within the maximum number of lines and inside the bounding rectangle. To specify which part of the text the label should truncate, set the lineBreakMode property.
When the sizeToFit() method resizes a label, resizing takes into account the value stored in this property. For example, if the number of lines is 3, the sizeToFit() method resizes the label so that it’s big enough to display three lines of text in the current font.