How can I make a multiline UILabel
in interface builder for iOS? I tried the UITextView
but it didn't quite suit my needs.
How can I add multiline (text) in label?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With