UILabel With font size bigger than label height

326 views Asked by At

Is it possible to fit in a text when the font size and the label heights don't match.

bigData = [[UILabel alloc] initWithFrame:(CGRect){20, 20, 100, 23}];
bigData.textColor = [UIColor colorWithHex:0xffffff alpha:1];
bigData.font = [UIFont fontWithName:@"Helvetica" size:32];

The label height is 23 and the font size is 32. This causes a portion of the text to be hidden. Is there anything logically wrong?

1

There are 1 answers

0
Shabarinath Pabba On BEST ANSWER

You will either need a label whose height is greater or decrease the font size, or use bigData.adjustsFontSizeToFitWidth

So the answer is "NO" you can't fit a font that is greater than the height of a UILabel