title: iOS Table View beginUpdates visual bug, black cells
body: <p>I have a bug that I've spent way too much time on myself. Basically, I'm creating an "accordion" Table View based off Apple docs: 
  <a href="https://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Listings/ReadMe_txt.html#//apple_ref/doc/uid/DTS40010139-ReadMe_txt-DontLinkElementID_3" rel="nofollow">https://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Listings/ReadMe_txt.html#//apple_ref/doc/uid/DTS40010139-ReadMe_txt-DontLinkElementID_3</a>
  The way the code works is that if you tap on a Table View Header, code gets called to add rows to that section.</p>
  
  <p>The only thing that's different is the fact that it's for iOS 5, so for my header views I'm not using the reusable header view stuff.</p>
  
  <p>Basically, every time I click on a header to show my rows, the cells that are added/removed via [tableView beginUpdates]/[tableView endUpdates] turn black. HOWEVER, if I scroll the table view after then it goes back to being normal.</p>
  
  <blockquote>
    <p><strong>Pictures showing this in action: <a href="http://imgur.com/a/B3lMu" rel="nofollow">http://imgur.com/a/B3lMu</a></strong></p>
  </blockquote>
  
  <p>Some code of how I remove cells :</p>
  
  <blockquote>
  <pre><code>// GET THE SECTION INFO
  SWDeviceSectionInfo *deviceSectionInfo = [self.deviceTableSectionInfo objectAtIndex:section];
  </code></pre>
  </blockquote>
  
  <pre><code>// "CLOSE" THE SECTION
  deviceSectionInfo.open = NO;
  
  // CREATE INDEX PATHS FOR ROWS THAT NEED TO BE DELETED
  NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init];
  
  for (int i=0;i&lt;deviceSectionInfo.rowInfo.count;i++) {
  
      // CREATE INDEX PATHS FOR EACH ROW
      [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:section]];
  }
  
  // APPLY THE ROW INSERTIONS
  [self.deviceTableView beginUpdates];
  [self.deviceTableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:UITableViewRowAnimationBottom];
  [self.deviceTableView endUpdates];
  </code></pre>
  
  <p>Some extra notes: </p>
  
  <ol>
  <li>The background for the cells after scrolling table view is that of the Table View (I can't set the BG for cells). The Yellow view is a view on TOP of the cell background that's supposed to be green.</li>
  <li>If I click on the iOS simulator debug "color" then again, the black cells disappear.</li>
  <li>I've tried changing "highlighted", "selected" color to random colors and nothing changes. Remains a black cell bug.</li>
  <li>I've triple checked the code for stuff like adding cells to the wrong section, all of that is seemingly correct. </li>
  <li>The bug also occurred when I was using the default white cells (no custom nib).</li>
  </ol>