title: cellForRowAtIndexPath doesn't get called after calling reloadData in UICollectionView
body: <p>I have a <code>UICollectionView</code> which uses a subclass of <code>UICollectionViewCell</code>'s. Initially, my <code>dataSource</code> contains 5 items, and when the user scrolls down, I fetch more data and add them to my <code>dataSource</code>, then I call <code>reloadData</code>.</p>
  
  <p>But only 3 items are visible. and when I scroll up I can't see the rest of the items, just an empty area. I noticed that <code>cellForRowAtIndexPath</code> only gets called for those 3 items.</p>
  
  <p>When I navigate to my parent view, and back to the view which contains my <code>UICollectionView</code> I can see all the items.</p>
  
  <p><strong>Note:</strong> I have implemented <code>layout:sizeForItemAtIndexPath</code> function as each cell has a different size. </p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I partially solved the issue. I had a refreshControl and I called endRefreshing in a background thread.</p>
  
  <p>Am adding images for a better demonstration of what's happening now: </p>
  
  <ul>
  <li>The 1st image is before fetching new data, as u can see the data is displayed perfectly.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/x4mFs.png" alt="enter image description here"></p>
  
  <ul>
  <li>The 2nd image is after fetching new data, as u can see the new items take the exact height of the previous ones (the old cells) and there is an empty area, when I scroll down I can see the rest of the data, and when I scroll back up, the top cells get the right height, as shown in the 3rd image.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/tAXQe.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/CNJLm.png" alt="enter image description here"></p>
  
  <p>After I finish loading new items, I call this method</p>
  
  <pre><code>- (void)updateDataSource
  {
     self.collectionViewDataSource = _manager.messages;
     [self.collectionView reloadData];
  }
  </code></pre>
  
  <p>I checked numberOfItemsInSection method, it returns the right number of items.</p>
  
  <p>and here is my layout:sizeForItemAtIndexPath</p>
  
  <pre><code>- (CGSize)collectionView:(UICollectionView *)collectionView layout:   (UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:  (NSIndexPath *)indexPath 
  {
  // Here I am calculating the width and height of the textView which will fit the message
  
  SPH_PARAM_List *feed_data=[[SPH_PARAM_List alloc]init];
  feed_data=[self.collectionViewDataSource objectAtIndex:indexPath.row];
  
  if ([feed_data.chat_media_type isEqualToString:kSTextByme]||[feed_data.chat_media_type isEqualToString:kSTextByOther])
  {
  
      NSAttributedString *aString = [[NSAttributedString alloc] initWithString:feed_data.chat_message];
  
      UITextView *calculationView = [[UITextView alloc] init];
      [calculationView setAttributedText:aString];
  
      [calculationView setFont:[UIFont systemFontOfSize:14]];
      [calculationView setTextAlignment:NSTextAlignmentJustified];
  
  
      CGSize sc = [calculationView sizeThatFits:CGSizeMake(TWO_THIRDS_OF_PORTRAIT_WIDTH, CGFLOAT_MAX)];
  
      NSLog(@"IndexPath: %li Height: %f", (long)indexPath.row ,sc.height);
  
      return CGSizeMake(self.view.frame.size.width - (5 * 2), sc.height);
  
  }
  
  return CGSizeMake(self.view.frame.size.width - (5 * 2), 90);
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I noticed that layout:collectionViewLayoutsizeForItemAtIndexPath: gets called and it returns the right height, but cellForItemAtIndexPath still deals with an old one.</p>