Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 24th, 2012  |  syntax: None  |  size: 0.74 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Add cells to top of UITableView
  2. - (void)controllerDidChangeContent:(NSFetchedResultsController*)controller
  3. {
  4.     UITableViewCell *referenceCell;
  5.     if ([self.tableView.visibleCells count] > 0) {
  6.         referenceCell = [self.tableView.visibleCells lastObject];
  7.     }
  8.     CGFloat offset = referenceCell.frame.origin.y - self.tableView.contentOffset.y;
  9.  
  10.     [self.tableView endUpdates];
  11.  
  12.     [self.tableView setContentOffset:CGPointMake(0.0, referenceCell.frame.origin.y - offset) animated:NO];
  13. }
  14.        
  15. for (UITableViewCell *cell in [tableView visibleCells])
  16. {
  17.   [cell.layer removeAllAnimations];
  18. }
  19.        
  20. [tableview selectRowAtIndexPath: animated:NO scrollPosition:<#(UITableViewScrollPosition)#>];
  21.        
  22. [[tableview indexPathsForVisibleRows] objectAtIndex:0];