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

Fredric Cliver
Jul 19, 2021

--

The title sound like complicated, so here is layout

Layout

Solution

  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 ]

--

--

Fredric Cliver
Fredric Cliver

Written by Fredric Cliver

13+ years in the digital trenches. I decode complex tech concepts into actionable insights, focusing on AI, Software Engineering, and emerging technologies.

No responses yet