title: How to resize the container view with respect to its embedded view controller?
body: <p>I want to resize the superview with respect to its subview.</p>
  
  <p>The scenario is that I have a scroll view inside it there is a view with different subviews. Within the subviews, there is a ContainerView with embedded view controller. Which have a table view. I want to increase the size of the table view as the cell increases and in the same the increase the height of view- container - view and scroll view, Because the table wont scroll.</p>
  
  <p>i was able to increase the size of the table view following the link
  <a href="https://stackoverflow.com/questions/14223931/change-uitableview-height-dynamically">enter link description here</a></p>
  
  <p>but i am stuck how can i increase the size of the embedded view.
  <a href="https://i.stack.imgur.com/1K5bZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1K5bZ.png" alt="enter image description here"></a></p>
  
  <p>To elaborate more i am attaching images from a project i am practicing on.</p>
  
  <p><a href="https://i.stack.imgur.com/YlPqY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YlPqY.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>Purple is the color of the main view controller.</li>
  <li>Green is scroll view.</li>
  <li>Grey is view inside scroll view.</li>
  <li>Blue is the color of embedded View
  controller.</li>
  <li><p>Red is the color of table view. but cant be seen on simulator as it has resized according to the number of cells.</p>
  
  <pre><code>-(CGSize)sizeForChildContentContainer:(id&lt;UIContentContainer&gt;)container
             withParentContainerSize:(CGSize)parentSize
  {
  
       //    int height = _containerView.frame.size.height;
       NSLog(@"height of container");
       return _tableView.frame.size;
  }
  
  -(void)adjustHeightOfTableview
  
  {
  
       CGFloat height =  self.tableView.contentSize.height;
       CGFloat maxHeight = self.tableView.superview.frame.size.height -  self.tableView.frame.origin.y;
  
  
       // if the height of the content is greater than the maxHeight of
       // total space on the screen, limit the height to the size of the
       // superview.
  
      if (height &gt; maxHeight)
          height = maxHeight;
  
      // now set the height constraint accordingly
  
      [UIView animateWithDuration:0.25 animations:^{
         self.tableViewHeightConstraint.constant = height;
         [self.view setNeedsUpdateConstraints];
  
      }];
  
      [_tableView setNeedsLayout];
      [_tableView layoutIfNeeded];
  }
  </code></pre></li>
  </ul>
  
  <p>In the same way or some thing like that i need to resize the view.
  I have searched for some thing similar but i did not got a clear answer, any kind of help will be appreciated.</p>