Autoexpand UITextView height to contain the complete text loaded dynamically
ios, uitextview
Solution
You can do this by adding these few lines of code to your application's:-
CGRect frame = textView.frame;
frame.size.height = textView.contentSize.height;
textView.frame = frame;
Implement this code in th delegate method of textview
- (void)textViewDidChange:(UITextView *)textView
{
// you might have to compare the frames if it needs changing as user might not have added an extra line
}
Problem
I have a simple textView who's data gets populated dynamically. I want to resize the height of the textview once the data is populated so that i dont see a vertical scroll nor the text gets clipped. Could it be done simply by choosing one of those textView modes or do i need to do it programaticaaly?