title: How to vertical align (center) the content of UITableView?
body: <p>I want to center the content of my <code>UITableView</code> that contains <code>headerView</code> and <code>footerView</code> created at storyboard, and <code>UITableViewCell</code>s. How can I achieve this?</p>
  
  <p>Here is what I'm trying to implement to solve my problem but this does not work.</p>
  
  <pre><code>- (void)viewWillAppear:(BOOL)animated
  {
      [super viewWillAppear:animated];
  
      CGFloat height = self.tableView.frameHeight - self.navigationController.navigationBar.frameHeight - [UIApplication sharedApplication].statusBarFrame.size.height - (self.rowCount * self.rowHeight);
      self.tableView.tableHeaderView.frameHeight = height / 2.0;
  }
  </code></pre>
  
  <p>So I subtracted the height of the navigationBar &amp; statusBar and cells' height to the tableView's height to get the height of the empty area.
  Now that I get the height if the empty area, I divided it to 2 for the footer and header's view.</p>