Sheehan Alam Sheehan Alam - 6 months ago 61
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 ]];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download