0

I'm looking for 5 hours right now, and no solutions on whole stack overflow is working. So I hope someone comes with the magic trick.

I set text to the textview like this :

[TextMessages setText:[fromOtherView objectForKey:@"message"]];

But the content does not fit the textview. How can I make the UITextView big enough to fit the content?

I tried many options like :

CGRect frame = _textView.frame;
frame.size.height = _textView.textContainer.size.height;
_textView.frame = frame;

Its on iOS 7

Rich
  • 8,108
  • 5
  • 46
  • 59
KEVIN
  • 155
  • 2
  • 13

1 Answers1

0

Try following code: This works in iOS6 and iOS7

  CGSize textViewSize = [self.myTextView sizeThatFits:CGSizeMake(self.myTextView.frame.size.width, FLT_MAX)];
self.myTextView.height = textViewSize.height;

Check this link for more

Community
  • 1
  • 1
Chitra Khatri
  • 1,260
  • 2
  • 14
  • 31