Set proper height for UITextView which is inside of UIStackView and UITable.headerView



  1. Set a layout constraint for the height of UITextView
  2. Set a height of text view using sizeThatFits method. It makes the contentSize value properly
  3. Change UITextView height using contentSize value of the UITextView

Before & After

[ Left: not fit height ], [ Right: Fitted height ]



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fredric Cliver

Fredric Cliver

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧