title: How to scroll to the bottom of a UITableView on the iPhone before the view appears
body: <p>I have a <code>UITableView</code> that is populated with cells of a variable height. I would like the table to scroll to the bottom when the view is pushed into view.</p>
  
  <p>I currently have the following function</p>
  
  <pre><code>NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[log count]-1 inSection:0];
  [self.table scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:NO];
  </code></pre>
  
  <p>log is a mutable array containing the objects that make up the content of each cell.</p>
  
  <p>The above code works fine in <code>viewDidAppear</code> however this has the unfortunate side effect of displaying the top of the table when the view first appears and then jumping to the bottom. I would prefer it if the <code>table view</code> could be scrolled to the bottom before it appears.</p>
  
  <p>I tried the scroll in <code>viewWillAppear</code> and <code>viewDidLoad</code> but in both cases the data has not been loaded into the table yet and both throw an exception.</p>
  
  <p>Any guidance would be much appreciated, even if it's just a case of telling me what I have is all that is possible.</p>