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

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.85 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. UITableView NSFetchedResultsController philosophy
  2. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  3.  
  4. {
  5.     if (editingStyle == UITableViewCellEditingStyleDelete) {
  6.  
  7.         // Delete the row from the data source
  8.        [myContext deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];
  9.  
  10.         if (![myContext save:&error]) {
  11.             // Error handling
  12.         }  
  13.  
  14.         fetchedResultsController = nil;
  15.  
  16.         if (![[self getFetchedResultController] performFetch:&error]) {
  17.              // Error handling
  18.         }
  19.         [tableView reloadData];        
  20.     }  
  21. }
  22.        
  23. fetchedResultsController = nil;
  24.  
  25.         if (![[self getFetchedResultController] performFetch:&error]) {
  26.              // Error handling
  27.         }
  28.         [tableView reloadData];