title: Resize UITableView programmatically inside a UIScrollView and avoid AutoLayout Constraints
body: <p>I have a UIScrollView that contains some components inside. One of these controls is a UITableView, which is used to display a list of schedules for a movie, at most would be about 7 rows.</p>
  
  <p>I set the UITableView to not allow movement of any kind, and programmatically change its size to fit to its content and also increase the content size of UIScrollView so that it can scroll smoothly.</p>
  
  <p>As soon as the view is displayed on the screen, resizing works correctly, but when I scroll the UIScrollView to see below, the UITableView returns to its previous size.</p>
  
  <p>See the next image: <a href="http://d.pr/i/rKzb">http://d.pr/i/rKzb</a></p>
  
  <p>I am using Storyboard AutoLayout for design the interface, and the UITableView has the following restrictions:</p>
  
  <p><a href="http://i.stack.imgur.com/GowOG.png">http://i.stack.imgur.com/GowOG.png</a></p>
  
  <p>Here is how I'm resizing the controls:</p>
  
  <pre><code>- (void) resizeViews {
      //
      // Synopsis
      //
      CGRect synopsisNewFrame = [Utilities adjustLabel:_movieSynopsis frameForText:_movieSynopsis.text];
      [_movieSynopsis setFrame:  synopsisNewFrame];
  
  
      //
      // Schedules
      //
      CGRect schedulesNewFrame = CGRectMake(self.tableView.frame.origin.x,
                                        _movieSynopsis.frame.origin.y + _movieSynopsis.frame.size.height + 4,
                                        self.tableView.frame.size.width,
                                        self.tableView.contentSize.height);
  
      [self.tableView setFrame: schedulesNewFrame];
  
      //
      // Scroll View
      //
  
      CGSize scrollSize = CGSizeMake(292, self.tableView.frame.origin.y + self.tableView.frame.size.height + 10);
  
      [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
      [_tableView setTranslatesAutoresizingMaskIntoConstraints:NO];
  
      [self.tableView setContentSize: scrollSize];
      [self.tableView setContentOffset:CGPointMake(0, 0)];
  
  } 
  </code></pre>
  
  <p>And here is where I'm calling the resizeView (in the ViewController):</p>
  
  <pre><code>- (void) viewDidAppear:(BOOL)animated {
      [self resizeViews];
  }
  </code></pre>
  
  <p>Is there any way to avoid this to happen?</p>
  
  <p>I'm pretty sure the problem is the constraints that have the UITableView.</p>
  
  <p>Let me suggest solution to prevent this from happening, while using AutoLayout.</p>
  
  <p>Thanks in advance for your help.</p>
  
  <p>(Sorry I can't post images)</p>