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

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 ]

--

--

--

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 ☔️ 🇬🇧

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

iOS 14: Custom Accessibility Content

VoiceOver rotor showing More Content

SwiftUI: Displaying Mathematical Fractions

Birthday Party in Xcode — Introduction to wrappers and unwrapping of nasty optional

How to optimize the tracking process in iOS 14.5+

Implementing Protocols in Swift

“FIRAnalyticsConnector.framework/FIRAnalyticsConnector’ for architecture arm64” error handling

What’s incipient in Swift 5.2

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 ☔️ 🇬🇧

More from Medium

Let’s burn your code by fire 🔥

CS373 Spring 2022: Jack Si

Hawksight — why is it worth taking part in the project?!

Digital Tools I Use