0

I have a stackView like this.enter image description here

If Data has not images image will be hidden. Then label's text is "" , but label's height is to be long. I want label does not fill stackview. How can I do?

JJHA
  • 76
  • 7

1 Answers1

0

A tableview or a collectionview might be more appropriate for UI containers. They are more suitable for a dynamic feature like you mentioned. Having said that you can play with the configuration of the stack view distribution, spacing, and alignment to dynamically set the StackView to accommodate the sizes you wish. In addition to set sizes of subview using - intrinsiccontentsize

Here are two links that can help you with that: UIStackView 1 UIStackView 2 Intrinsiccontentsize

CloudBalancing
  • 1,461
  • 2
  • 11
  • 22
  • But I dont want use tableview or collectionview.. – JJHA Jul 25 '22 at 09:11
  • 1
    I understand you don't, presonally I think you should. But if you insist on keep using StackView please learn its properties and use them to achieve what you need – CloudBalancing Jul 25 '22 at 09:58