I have a UITextView
with Autolayout ON inside storyboard view controller. I want to increase its height dynamically according to text of the UITextView
. I'm able to increase its size but there is extra space below text. How can I remove this extra space?
I tried these lines of code:
[_descriptionText setText:string];
CGSize sizeThatFitsTextView = [_descriptionText sizeThatFits:CGSizeMake(_descriptionText.frame.size.width, MAXFLOAT)]
_descriptionTextHeight.constant = sizeThatFitsTextView.height;
Here _descriptionText
is a UITextView
and _descriptionTextHeight
is a height constraint which I'm using to resize the UITextView
.
I've also tried these lines of code:
[_descriptionText setText:string];
_descriptionTextHeight.constant = [_descriptionText intrinsicContentSize].height;
I was able to remove that extra space but UITextView size was not increasing. One more point I want to add here, I don't want to enable scroll.