title: Xcode storyboard with dynamic views
body: <p>I have a problem about <code>Xcode</code> storyboard and dynamically showed views.</p>
  
  <p>I have 3 vertically aligned views in my storyboard and each one is linked with each other with top-bottom relationship with constraints</p>
  
  <p>However during runtime I want to hide the 2nd view and replace its place with the 3'rd view (which is a <code>tableview</code>) and to fill the both 2nd and 3rd places I'm trying to extend the height of <code>tableview</code>. 
  However I cannot succeed. I have tried lots of things but closest thing I get is to transform the 3rd view to 2nd place but the height remains the same</p>
  
  <p>My latest code is in below</p>
  
  <pre><code>    if (status) {
  
         self.filterView.hidden = NO;
         self.contentTable.frame = contentTableFrame;
  
      } else {
  
         self.filterView.hidden = YES;
         CGFloat predictedHeight = self.contentTable.frame.size.height+(self.contentTableFrame.origin.y-self.filterView.frame.origin.y);
      self.contentTable.transform = CGAffineTransformMakeTranslation(0,       self.filterView.frame.origin.y-self.contentTable.frame.origin.y);
  
         for (NSLayoutConstraint *constraint in self.contentTable.constraints) {
             if (constraint.firstAttribute == NSLayoutAttributeHeight) {
                  constraint.constant = predictedHeight;
             }
  
         }
  
      }
  </code></pre>
  
  <p>You can also find the screenshot of the 3rd view's constraints. What should I do to fix that? Does anyone have any idea about it?</p>
  
  <p><a href="https://i.stack.imgur.com/RzRqI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RzRqI.png" alt="enter image description here"></a></p>
  
  <p>I also have another solution to this problem . But I've another problem on that too.
  When I executed the below line of code my 3rd view move to 2nd view's place but its height remains the same so on the bottom of the page it happens to seems a blank space. </p>
  
  <pre><code>        self.contentTable.transform = CGAffineTransformMakeTranslation(0,       self.filterView.frame.origin.y-self.contentTable.frame.origin.y);
  </code></pre>
  
  <p>In order to fix that I've tried to change its height(with .frame = CGRectMake(.....) ) 
  but it didn't work.Then I've tried to scale the 3rd view(which is a tableview) and it succeed but because I've scaled it all the cells inside the tableview scaled too and the visual appearance of the table has broken. So I couldn't able to find a solution to that problem.
  It seemed like a challenge.</p>
  
  <p>Thanks</p>