title: UIScrollView setContentSize with subviews also laid out using constraints
body: <p>Suppose i have the following <strong>implementation</strong>:</p>
  
  <ul>
  <li><code>UIPageViewController</code></li>
  <li><p><code>UIScrollView</code> called <em>mainScrollView</em> added as <code>subview</code> to the <code>UIPageViewController.view</code></p>
  
  <p>[UIScrollView setTranslatesAutoresizingMaskIntoConstraints:NO];</p></li>
  <li><p><code>UIScrollView</code> subviews laid out using <code>NSLayoutConstraints</code> and each of the subviews has been <code>setTranslatesAutoresizingMaskIntoConstraints</code> to NO.</p></li>
  </ul>
  
  <p>How can i set the content size of the <code>UIScrollView</code> to be equal to the biggest MaxY coordinate within its subviews?</p>
  
  <p>This is a sample of my code:</p>
  
  <pre><code>UIScrollView *scrollView = [self mainScrollView];
  UIView *superView = [self view];
  NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(scrollView, superView);
  [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView(==superView)]|" options:0 metrics: 0 views:viewsDictionary]];
  [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(==superView)]|" options:0 metrics: 0 views:viewsDictionary]];
  
  UIView *previousView = scrollView;
  for (int i=0;i&lt;150; i++) {
      UITextView * textView = [[UITextView alloc] init];
      [textView setBackgroundColor:[UIColor colorWithRed:101.1f/255.f green:175.f/255.f blue:105.f/255.f alpha:1.f]];
      [textView setTranslatesAutoresizingMaskIntoConstraints:NO];
      [scrollView addSubview:textView];
      [scrollView addConstraint:[NSLayoutConstraint constraintWithItem:textView
                                                             attribute:NSLayoutAttributeTop
                                                             relatedBy:NSLayoutRelationEqual
                                                                toItem:previousView
                                                             attribute:NSLayoutAttributeTop
                                                            multiplier:1
                                                              constant:50]];
      [scrollView addConstraint:[NSLayoutConstraint constraintWithItem:textView
                                                             attribute:NSLayoutAttributeLeft
                                                             relatedBy:NSLayoutRelationEqual
                                                                toItem:textView.superview
                                                             attribute:NSLayoutAttributeLeft
                                                            multiplier:1
                                                              constant:0]];
      [scrollView addConstraint:[NSLayoutConstraint constraintWithItem:textView
                                                             attribute:NSLayoutAttributeWidth
                                                             relatedBy:NSLayoutRelationEqual
                                                                toItem:scrollView
                                                             attribute:NSLayoutAttributeWidth
                                                            multiplier:1
                                                              constant:0]];
      [scrollView addConstraint:[NSLayoutConstraint constraintWithItem:textView
                                                             attribute:NSLayoutAttributeHeight
                                                             relatedBy:NSLayoutRelationEqual
                                                                toItem:scrollView
                                                             attribute:NSLayoutAttributeNotAnAttribute
                                                            multiplier:1
                                                              constant:40]];
      previousView = textView;
  }
  </code></pre>