iOS multiline label in Interface builder

8 Solutions Collect From Internet About “iOS multiline label in Interface builder”

You have to assign numberOfLines property. You can do it via code:

textLabel.numberOfLines = 5; // for example

Or via Interface Builder:
enter image description here

Hit Control+Enter to add a line in UILabel in Interface Builder/Storyboard.

Thanks AppleVijay!

Also to call sizeToFit, like this:

label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0;
[label sizeToFit];

The height will be automatically computed.

set width of label as u needed small then use IB to set line breaks to word wrap

or use with code like this

I found a solution.

One just has to add the following code:

textLabel.lineBreakMode = NSLineBreakByWordWrapping;
textLabel.numberOfLines = 0;

In iOS7 (Xcode5) you shold set the lines of UILabel to 0 for unlimited multiple input in storyboard.
The most important is to set the height of the UILabel can hold the lines of input you are going to set.

textLabel.lineBreakMode = UILineBreakModeWordWrap;

textLabel.numberOfLines = 0;

CGSize size =  [[[arrNewsFeed objectAtIndex:row] objectForKey:@"c"]  sizeWithFont:[UIFont systemFontOfSize:14.0]  constrainedToSize:CGSizeMake(188, CGFLOAT_MAX)
                                                                     lineBreakMode:NSLineBreakByTruncatingTail];

textLabel.frame = (CGRect){.origin = cell.lblNewsDescription.frame.origin, .size = size};

Swift 3
Set number of lines zero for dynamic text information, it will be useful when your text are varying.

label.numberOfLines = 0
label.lineBreakMode = .byTruncatingTail // or .byWrappingWord
label.minimumScaleFactor = 0.8

For X-Code 7.2

  1. — Select UILabel

  2. — Attributes inspector

  3. — Text – Select Attributed

After this you can see some more attribute you can add into you label, in which you can also find number of Lines. Which make your label multiline.

X-Code Image for a multiline UILabel