Tag Archives: UILabel

iPhone – Wrap Text in UILabel

In UILabel, there is an adjustsFontSizeToFitWidth property which will automatically adjust the text font size to fit the UILabel width.

UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 20.0)];
aLabel.adjustsFontSizetoWidth = YES; // This is a must
aLabel.minimumFontSize = 8.0f; 
aLabel.numberOfLines = 1; // This is a must too =.=

But this only work for numberOfLines = 1Continue reading iPhone – Wrap Text in UILabel