Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnonymous Person
5,297 PointsMultiple lines in a UILabel
How do I get multiple lines within a UILabel through code?
Kristopher Van Sant
Courses Plus Student 18,830 PointsHey there Anonymous! I removed your extra posts. Only one post is needed per question. :)
1 Answer
Michael Hulet
47,913 PointsThere's actually a property on UILabel
to set the number of lines it can use. You can either set it to an explicit number of lines, or you can set it to 0
, and it'll use as many as it needs. You can try this:
// Let the label use an unlimited amount of lines
label.numberOfLines = 0
// Resize the label so you can see all the text inside
label.sizeToFit()
A X
12,842 PointsA X
12,842 PointsAnon, your post posted six+ times, you might want to delete the extras.