I have a Text View box and I want that rectangle to stay the same size while the text inside autoshrinks to fit the box. The reason I need this is because the text is pulled from a plist and the strings are all different lengths. Labels have an Autoshrink feature which is exactly what I want, but I can't figure out a way even through code to get a Text View to do the same thing. Please help!
UILabel
s can have more than one line of text. You just need to set the following:
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0; // 0 = unlimited number of lines, set to another number to have that as maximum
I'm not entirely sure if this works, but you can then combine this with label.adjustsFontSizeToFitWidth = YES;
to have a multi-line label that autoshrinks text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With