title: iOS UITableView delete cells with animation one by one
body: <p>I want to delete some cells in a table view with animation one by one, at first I use code like this:</p>
  
  <pre><code>[self beginUpdates];
  [self deleteRowsAtIndexPaths:removeIndexPaths withRowAnimation:UITableViewRowAnimationFade];
  [self endUpdates];
  </code></pre>
  
  <p>There are six indexPaths in removeIndexPaths array. It works in the right way, but the animation effect is 1. the six cells be empty,2. fade the empty area.</p>
  
  <p>Then I try to delete them with for/while,like this:</p>
  
  <pre><code>int removeIndexRow = indexPath.row + 1;
  while (item.level &lt; nextItemInDisplay.level)
  {
      NSIndexPath *removeIndexPath = [NSIndexPath indexPathForRow:removeIndexRow inSection:0];
      [items removeObject:nextItemInDisplay];
      [self beginUpdates];
      [self deleteRowsAtIndexPaths:@[removeIndexPath] withRowAnimation:UITableViewRowAnimationFade];
      NSLog(@"1");
      sleep(1);
      NSLog(@"2");
      [self endUpdates];
  }
  </code></pre>
  
  <p>In order to know how the function works, I use sleep and NSLog to output some flag. Then I find that the result is after outputting all the flags, the six cells been closed together, and the most unbelievable thing is that their animation like this:1.last five cells disappear with no animation, 2.the first cell be empty,3.fade the first cell empty area.</p>
  
  <p>But what I want is delete cells one by one,first the first cell be empty and fade it,then the second, third...How can I solve it?</p>