Custom UIView from XIB has no height in UIStackView
<p>I am adding a custom UIView to a UIStackView inside a UIScrollView. The custom UIView is created from a XIB without a fixed width. I use autolayout to horizontally constrain the custom view to the UIStackView. All the subviews in the custom view have either a fixed height or an intrinsic height (i.e. labels).</p>

<p>When I add the UIView to the UIStackView, they pile on top of each other, as if they have no height. <strong>How do I ensure the correct height of my custom view inside the stack view based on the constraints from interface builder?</strong></p>

<p>Here is how I am adding the custom view to the UIStackView:</p>

<pre><code>CustomView *customView = [CustomView loadFromXib]; // helper to load from xib
customView.translatesAutoresizingMaskIntoConstraints = NO;
[_stackView addArrangedSubview:customView];
[_stackView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[customView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:@{@"customView": customView}]];
</code></pre>

<p>I suspect the issue involves the <code>intrinsicContentSize</code> of my custom view, but I would think that would be set from the constraints specified for the XIB in interface builder.</p>