title: How to get all cells in a UITableView
body: <p>Let's say I have a UITableView which has multiple rows. I want to get all the UITableViewCells as an NSArray at a certain point of time. I have tried </p>
  
  <pre><code>[tableView visibleCells] 
  </code></pre>
  
  <p>but there is a problem with this approach: I can not have all those cells which are not currently in the current screen. So I turned to another approach:</p>
  
  <pre><code>-(NSArray *)cellsForTableView:(UITableView *)tableView
  {
      NSInteger sections = tableView.numberOfSections;
      NSMutableArray *cells = [[NSMutableArray alloc]  init];
      for (int section = 0; section &lt; sections; section++) {
          NSInteger rows =  [tableView numberOfRowsInSection:section];
          for (int row = 0; row &lt; rows; row++) {
              NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
              UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];   // **here, for those cells not in current screen, cell is nil**
              [cells addObject:cell];
          }
      }
      return cells;
  }
  </code></pre>
  
  <p>but seems that this approach still can not get those cells which are not displayed in the screen. Can anyone help me on this?</p>