Here I see three options.
First, make the label size large enough to save any text. This is the simplest, but it does not always work well - it depends on its surrounding views.
Secondly, Label can adapt the font size for longer text ( adjustsFontSizeToFitWidth property). This is often undesirable; different fonts in elements may look ugly.
The last option is to programmatically change the size of the label in accordance with its current text. To calculate the size needed to store text with the current font, use something like the following:
CGSize textSize = [[someLabel text] sizeWithFont:[someLabel font] forWidth:someLabel.bounds.size.width lineBreakMode:UILineBreakModeWordWrap];
Michal Nov 04 '10 at 8:10 2010-11-04 08:10
source share