title: Resize table cell after image downloaded
body: <p>I am using SDWebImage library to download image and load into image view inside a table cell.</p>
  
  <p>I want to resize the table cell after the image is downloaded. Please advice. Many thanks.</p>
  
  <p>Cell is not resize correctly after image set into image view
  <a href="https://i.stack.imgur.com/N3pJI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N3pJI.png" alt="enter image description here"></a></p>
  
  <p>Cell resize correctly after dequeue and load again</p>
  
  <p><a href="https://i.stack.imgur.com/SGrAW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SGrAW.png" alt="enter image description here"></a></p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCellWithIdentifier(GagListTableViewCell.cellId, forIndexPath: indexPath) as! GagListTableViewCell
      cell.layoutMargins = UIEdgeInsetsZero
      let gagDataCommand = gagDataSource[indexPath.row]
  
      if let caption = gagDataCommand.caption {
          cell.captionLabel.text = caption
      }
  
      if let imageUrlStr = gagDataCommand.images?.normal {
          if let imageUrl = NSURL(string: imageUrlStr) {                
              cell.gagImage.sd_setImageWithURL(imageUrl, placeholderImage: UIImage(named: AppConstants.imagePlaceHolderName), completed: { (image, error, cacheType, url) in
                   //guess I need to redraw the layout here
              })
          } else {
              //fail to get image url, set placeholder image to the cell instead
              cell.gagImage.image = UIImage(named: AppConstants.imagePlaceHolderName)
          }
      }
  
      return cell
  }
  </code></pre>