Reputation: 1901
I have added Label to my ViewController.xib.
The problem is that when the text of the label is too long, and only part of the text is seen. It would not go to the next line.
How can this be done?
Upvotes: 3
Views: 1174
Reputation: 112857
Set the property either programatically with:
@property(nonatomic) NSInteger numberOfLines
or in interface builder.
Here are the docs:
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, any text that does not fit within the maximum number of lines and inside the bounding rectangle of the label is truncated using the appropriate line break mode.
When the receiver is resized using the sizeToFit method, resizing takes into account the value stored in this property. For example, if this property is set to 3, the sizeToFit method resizes the receiver so that it is big enough to display three lines of text.
Upvotes: 4