title: How to have a UIScrollView fit its content size, up until a max before scrolling in autolayout
body: <p>I want to create a UIScrollView in <strong>autolayout</strong> that will fully contain it's content (does not scroll) until the content is a certain size (say 400), and then it starts scrolling.</p>
  
  <p>So I have my views laid out like this<a href="https://i.stack.imgur.com/D1zs3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D1zs3.png" alt="UIScrollView"></a></p>
  
  <p>If I set <code>Scroll View.height = ContentView.height</code>, then the scrollview expands to fit all of the content. So far so good.</p>
  
  <p>Now if I try to set a max height via  <code>Scroll View.height &lt;= 400</code>, what ends up happening is it sets the <code>ContentView.height</code> as well (due to <code>Scroll View.height = ContentView.height</code>) and the text becomes cut off and it doesn't scroll</p>
  
  <p><a href="https://i.stack.imgur.com/Efbvh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Efbvh.png" alt="cut off text"></a></p>
  
  <p>So is this even possible to do with autolayout? This seems easy to do with frames but I'd like a solution in autolayout.</p>
  
  <p>Here's the sample project if you'd like to play around yourself - <a href="https://github.com/iwllyu/content-hugging-uisv-with-max" rel="noreferrer">https://github.com/iwllyu/content-hugging-uisv-with-max</a></p>