iOS multiline label in Interface builder iOS multiline label in Interface builder ios ios

iOS multiline label in Interface builder


You can use numberOfLines property which defines maximum number of lines a label can have. By default, it's 1. Setting it to 0 means the label will have unlimited lines.

You can do it in code:

textLabel.numberOfLines = 5 // for example

Or in Interface Builder:


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.