You can use sizeThatFits:
to get the correct size.
CGFloat height = ceilf([textView sizeThatFits:textView.frame.size].height);
Here is a popular open source component that makes use of it to achieve dynamic resizing based on the textview content: https://github.com/HansPinckaers/GrowingTextView