Get UITextView dynamic height with auto layout after setting text

If you prefer to do it all by auto layout:

In Size Inspector:

  1. Set Content Compression Resistance Priority Vertical to 1000.

  2. Lower the priority of constraint height for your UITextView. Just make it less than 1000.

enter image description here

In Attributes Inspector:

  1. Uncheck Scrolling Enabled.

All you have to do is:

  • set up all your constraints except the height one AND
  • set textView's scrollEnabled property to NO

The last part is what does the trick.

Your text view will size automatically depending on its text value.