swiftuitableviewuitableviewautomaticdimension

Swift adapt height of view in base of your content


I have a view like this:

enter image description here

The label that contains "1 X Pizza wustel" can contains some rows.

Now if the label contains a few row all is ok. But if the label contains more than 3 rows I cannot display all rows.

There is a way to increase automatically the height of the View in base of your content?


Solution

  • Here's what you want to do - for the constraints of the StackView, instead of setting it "== 80" (or some other constant height), you want to set it to ">= 80", so as the StackView increases from its contents, it can grow along with it. It should look something like this

    enter image description here