I am trying to sort out a problem we have in a UITableViewCell
. There are nested UIStackView
s with subviews like UILabel
having an intrinsic content size. I created this example for simplified explanation of my problem:
Results in these interface builder errors:
Top Stack
View Need constraints for: Y position, height
Middle Stack
View Need constraints for: Y position, height
Bottom Stack
View Need constraints for: Y position, height
- To my (and my collegues) understanding, the stacks' and table view cell sizes should be determined by the
UILabel
s and their intrinsic content size. - The "Outer Stack View" has four space constraints to its superview (the "Table View Cell") with 0 as constants because ultimately the table view cell and all stack view sizes should be based on the content views.
- All
UIStackView
haveFill
for Alignment and Distribution attributes. - I just dragged it together from the library as depicted, no fiddling in the inspector. It is simple to reproduce.
- Adding 0-space top and bottom constraints to a label in relation to its parent stack view does not resolve the stack view allegedly lacking a height constraint.
- The suggested constraints of the interface builder are nonsense.
What is missing? I created an example project hosted on GitHub.