Mobile Development

Dynamic multi-line UILabel

Quick tip if you want a dynamic multi-line UILabel (i.e you don’t know how many lines there will be), just use this:

myLabel.numberOfLines = 0;

Easy!

Comments

Comment from Herpeset
Time: February 10, 2009, 2:17 pm

Thanks for this wonderful advice, it is really very easy and quickly.

Comment from peter j mason
Time: May 7, 2009, 10:08 am

Does this actually work for an iPhone. Thought I saw somewhere that it was a bug. I have
adjustFontsizeToFitWidth NO
minimumFontsize 0
lineBreakMode 0 (word)

It\’s not working for me?

Comment from Matt
Time: June 27, 2009, 4:43 pm

Wow, this is really useful. Many Thanks.

Comment from AsTeR
Time: November 4, 2009, 11:38 pm

Thanks guy !

Comment from Delmorpha
Time: November 16, 2009, 9:35 am

You’re a legend… just saved me a few hours of beating my head against a brick wall! Thanks! :)

Comment from Dave Mitchell
Time: November 16, 2009, 12:03 pm

Your welcome :)

Comment from leo
Time: December 1, 2009, 7:59 am

It works very well after making label size enough big to hold your text. pl. see settings: >label size >>size&position >>W/H

Comment from FUTTERSACK
Time: January 17, 2010, 3:42 pm

Thanks Dave for this tip. It is very useful

Comment from nedkelly
Time: March 9, 2010, 5:09 pm

Cheers mate… that did my head for ages…

Objective C can be simple…. CAN :)

Write a comment

* required fields

*

*


*