title: xcode autolayout hidden view takes up space
body: <p>I have been struggling all day to make this work but<br>
  but without success. I tried to set the Button Top Constraing (Vertical spacing)
  relative to the tableView.
  But when I hide the tableview from my swift code the tableview
  still takes up space.</p>
  
  <p><img src="https://i.stack.imgur.com/H2gW0.png" alt="layout views">
  <br>
  What I am trying to achieve is that when I hide the tableview it will
  no longer take up space and all above views in this case the button will
  be moved up like so:</p>
  
  <p><img src="https://i.stack.imgur.com/tAuH0.png" alt="enter image description here"></p>
  
  <p>I have also tried this:
  Set UIsearchbox top constraint then Set tableview top constraint
  and then set Button top constraint relative to tableview
  then created top constrait of Button relative
  to Uisearchbox with a priority of 250.
  But it still doesnt work.</p>