I have a requirement to scroll six different type of view, Each view has different size, One of the views is: About Me. In About Me, I have to show the title (i.e. ABOUT ME) and text below it and label height should be according to text height.
Till Now I have designed this requirement as:
Root View - Stack View * Item 1 with fix height * Item 2 with fix height * UIView as About Me: - Label as title - Label as text with max lines set to 0 and width equals to container width.
The problem is: I can not set fix height of about me UIView and it does not resize according to label text. Please suggest the appropriate solutions.
Hi you can get the intrinsic height of the stackView like this:
let size = stackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
I know Im kinda late to reply to this message. But I had the same issue and I found this piece of code. Thought anyone who looking for this might be useful :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With