title: Automatically adjust UIScrollView Height
body: <p>How would I go about dynamically adjusting the height of a <code>UIScrollView</code>? Basically I have a bunch of <code>UILabels</code> that are created (the exact number of UILabels is random) and the <code>UIScrollView</code> is to adjust its height automatically to accommodate the <code>UILables</code>. This is what I have thus far in the <code>viewDidLoad</code>.</p>
  
  <pre><code>- (void)viewDidLoad
  {
  [scroller setScrollEnabled:YES];
  [scroller setContentSize:CGSizeMake(320
                                      , 1500)];
  scroller.indicatorStyle = UIScrollViewIndicatorStyleWhite;
  { 
  </code></pre>
  
  <p>And this is the action that creates additional UILavels</p>
  
  <pre><code>-(IBAction)scheduale{
  int i;
  for(i=0; i&lt;[self retrieveTime] ; i++){
      //Add time label
      UILabel *timeLabel = [[UILabel alloc] init];
      timeLabel.frame = CGRectMake(10, (i+1) * 21, 31, 20);
      timeLabel.textColor = [UIColor whiteColor];
      timeLabel.backgroundColor = [UIColor colorWithRed:76.0/225.0 green:76.0/225.0 blue:76.0/225.0 alpha:1.0];
      NSString *labelString;
      labelString = [[NSNumber numberWithInt:i] stringValue];
      timeLabel.text = labelString;
      timeLabel.textAlignment = UITextAlignmentCenter;
      //theLabel.tag = (i+1) * 100;
      [scroller addSubview:timeLabel];
  }
  </code></pre>