Sheehan Alam Sheehan Alam - 1 month ago 9
Objective-C Question

Resize font size in UITextView

Is there a way to shrink the font-size in a UITextView if there is too much text? Similar to the UILabel?

Answer Source

Try this:

NSInteger lengthThreshold = 200;
if( [ textView.text length ] > lengthThreshold ) {
    NSInteger newSize = ... //calculate new size based on length

    [ textView setFont: [ UIFont systemFontOfSize: newSize ]];
}