title: How to center UITableView Section Footer with Support for Orientation?
body: <p>EDIT:
  After messing with this for days the real questions I have are the following:
   1. Does UITableView take up the entire view?<br>
   2. If so, how does it set the bounds of the cells to that it looks like it only takes up part of the view.
   3. How do I get the bounds of the cells - or more accurately how do I know the bounds of the visible area that the cells are taking up.  self.tableView.bounds.size.width does not help because it returns the width of the view.
  Thanks.
  Leaving the previous info below in case it helps make my question clearer.</p>
  
  <p>Can this be possible? 
  I have read the apple docs and trolled the forums here and elsewhere and can't find and answer to this.
  Does the footer in a UITableVIew actually take up the entire view no matter what you do?  Does it not have a concept of the table width?</p>
  
  <p>Example:</p>
  
  <pre><code>- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
      UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
      [footerView setBackgroundColor:[UIColor redColor]];
  
      return footerView;
  }
  </code></pre>
  
  <p>This code will create a red line from one edge to the other.  No matter what boundaries you give it the line will take up the entire view.  The problem with this is that if you want to center a label in that footer you don't have any way to know where center is if you are supporting orientation changes.
  For instance in an iPad app I am trying to do the following:</p>
  
  <pre><code>if ([footerText length] &gt; 0) {
      UIView *customView = [[[UIView alloc]initWithFrame:CGRectMake(0.0, 0.0, 0, 0.0)] autorelease];
  
      [customView setBackgroundColor:[UIColor grayColor]];
  
      UILabel *footerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
      footerLabel.numberOfLines = 2;
      footerLabel.adjustsFontSizeToFitWidth = NO;
      [footerLabel setTextAlignment:UITextAlignmentCenter];
      [footerLabel setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5]];
      [footerLabel setOpaque:NO];
      [footerLabel setTextColor:[UIColor whiteColor]];
      [footerLabel setShadowColor:[UIColor lightGrayColor]];
      [footerLabel setFont:[UIFont boldSystemFontOfSize:14]];
      [footerLabel setFrame:CGRectMake(customView.center.x/0.3, 0.0, 600, 40.0)];
      [footerLabel setText:footerText];
      [customView addSubview:footerLabel];
      [footerLabel release];
  
      NSLog(@"customView width = %f", customView.frame.size.width);
      NSLog(@"tableview width = %f", self.tableView.frame.size.width);
      NSLog(@"tableview center = %f", self.tableView.center.x);
  
      return customView;
  } else {
      return nil;
  }
  </code></pre>
  
  <p>The table's center in portrait should be 384 (it's in the detail view/right side) and 351.5 in landscape. But when I use setCenter or try to adjust the left edge based on that center it does not center up.</p>
  
  <p>Final question: How does one center a custom view in a footer with support for orientation when the footer seems to have no concept of the table bounds?  I must be missing something in the docs because this has to be a problem solved by someone else but I can't find it.
  Thanks for your time.</p>