In my application using ContainerView, which contains below Things
In some cases, I have to hide views, tableview. With below settings, I am able to show the container view with dynamic height
view.translatesAutoresizingMaskIntoConstraints = false
UITableView
contentSize
observer by changing tableview height.But here I am unable to get the dynamic height of the containerView content.
I have tried below options to get container view content height but no luck
containerView.frame.size.height
containerView.bounds.size.height
stackView.frame.size.height
stackView.bounds.size.height
setNeedsLayout()
with containterView, stackView before getting heightlayoutIfNeeded()
with containterView, stackView before getting heightoverride func viewDidLayoutSubviews()
, override func viewWillLayoutSubviews()
Finally found an answer, below are the steps to achieve the solution
>= 0
.stackView.setNeedsLayout(), stackView.layoutIfNeeded()
these on StackView