Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UILabel AutoResize cuts off the top part of the text

I have a UILabel which autoresizes along with its parent view. The label has AdjustsFontSizeToWidth turned on and has a minimum text size of 0 - so basically it tries to fit all the text into whatever size the UILabel is.

The problem I am having is that vertically the text gets cut off. So yes, the label is adjusting its font size to the width of the label but the text is too tall for the label and thus some of the text is getting cut off.

Is there anyway to work around this so that all of the text, the full height and full width are shown?

I attach an image to show what I mean. The red box is the parent view, the purple box is the UILabel.

Thanks for your help.

Text getting cut off

like image 769
BYZZav Avatar asked Dec 07 '25 03:12

BYZZav


1 Answers

What you are adjusting automatically is the Width and not the Height. The Height is something you'll have to adjust manually based on the maximum font size you will use. If the maximum (assigned initial) font size fits in height, so will the smaller one's do, after they are automatically adjusted

like image 190
Lefteris Avatar answered Dec 08 '25 17:12

Lefteris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!