0
votes

I'm trying to make table view with dynamic cell heights. Everything works fine and predictable except one case. In this case table cell have several subviews with fixed height, fixed vertical spacing between them, fixed space between top of table cell and top of the first subview, fixed space between bottom of table cell and bottom of last subview. And I expect that table view will have height of all its subviews and spaces. But it does't work, one of fixed horizontal constraint brakes at runtime. I made the same example in Interface Builder and found the problem, but I have no idea how to properly reach expected behavior.

enter image description hereenter image description here

1

1 Answers

0
votes

Conflicting constraints you get are only in the Interface Builder - they should not occur runtime.

Reason for this is that IB cannot adjust height of UITableViewCell based on constraints, i.e. dynamic cell height is computed only runtime, not in IB.

To fix this, you can set height of cell to expected constant in the IB (cell -> SizeInspector -> Row Height)