title: set height of uicollectionviewcell according to imagecontent size in it which is loaded in a background thread
body: <p>I need to change the uicollectionviewcell height according to the image in it.However the loading of the image takes some time and it is in a separate thread.So how do i return the height of the cell in the following method</p>
  
  <pre><code>- (CGFloat)collectionView:(UICollectionView *)collectionView
                     layout:(FRGWaterfallCollectionViewLayout *)collectionViewLayout
   heightForItemAtIndexPath:(NSIndexPath *)indexPath {
  
       PFObject *image =_media[indexPath.row];
       PFFile *userImageFile = image[@"mediaFile"];
  
      int height=nil;
      [userImageFile getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) {
          if (!error) {
              UIImage *image = [UIImage imageWithData:imageData];
  
             __block height=image.size.height;
          }
      }];
  
  
  
      return height;
  }
  </code></pre>
  
  <p>i know that this method wont work as height would be nil everytime.pls suggest a working solution.</p>