Is there any way to have a label wordwrap text as needed? I have the line breaks set to word wrap and the label is tall enough for two lines, but it appears that it will only wrap on line breaks. Do I have to add line breaks to make it wrap properly? I just want it to wrap if it can't fit it in horizontally.
Ios – UILabel – Wordwrap text
cocoa-touchiosiphoneuilabelword-wrap
Related Topic
- Ios – Multiple lines of text in UILabel
- Ios – Vertically align text to top within a UILabel
- Android – Auto Scale TextView Text to Fit within Bounds
- Ios – How to set top-left alignment for UILabel for iOS application
- Ios – UILabel is not auto-shrinking text to fit label size
- IOS: Multi-line UILabel in Auto Layout
Best Answer
If you set
numberOfLines
to 0 (and the label to word wrap), the label will automatically wrap and use as many of lines as needed.If you're editing a
UILabel
in IB, you can enter multiple lines of text by pressing option+return to get a line break - return alone will finish editing.