Sizing a Container View with a controller of dynamic size inside a scrollview
<p>I'm trying to create a container view, with a controller that has a dynamic height, inside a UIScrollView and have it sized automatically using auto layout.</p>

<p><img src="https://i.stack.imgur.com/J7j7t.png" alt="Storyboard illustrating the setup"></p>

<p>View Controller A is the scrollview, which has the container view included, along with more content below.</p>

<p>View Controller B is the view controller that I want to have a dynamic size and for all the content to be displayed in full height in View Controller A's Scroll View.</p>

<p>I'm having some problems getting the dynamic size of B to automatically set the size of the Container View in A. However if I set a height constraint on the Container View in A <img src="https://i.stack.imgur.com/hGzjn.png" alt="Container View in A to for example 250">, </p>

<p>It would be the expected output if View Controller B would also have 250 height. It also works fine for height 1000, so as far as I know, all the auto layout constraints are properly setup. Unfortunately, since the height should actually be dynamic, I would like to avoid setting a height constraint at all. </p>

<p>I'm not sure if there are any settings for view controller B I can set for it to automatically update its size depending on its contents, or if there are any other tricks I've missed. Any help would be much appreciated!</p>

<p>Is there any way to size the Container View in A according to how big the size of View Controller B is without setting a height constraint?</p>