Using autostart worked for me:
1) Place yours UITextViewso that the height is large enough for one line of text, and the bottom is attached to the bottom of the screen (or something under the text view).
2) Save the link in your view view controller NSLayoutConstraintfor the height of the text view.
3) Set your view controller as UITextViewDelegate
4) adjust the height of the text view when entering text and create a layout. For instance:
- (void)textViewDidChange:(UITextView *)textView;
{
self.textViewHeightConstraint.constant = textView.contentSize.height;
[self.textView layoutIfNeeded];
}
source
share