title: Swift 4 ImageScrollView resizing visible cells in UITableView
body: <p>I am using the ImageScrollView cocoa pod v1.5 inside a UITableViewCell (Swift 4). 
  I am downloading images from Firestore using SDWebImage (but also tried Kingfisher with no change in my issue). My images are 700x700 and are being displayed in a ImageScrollView that, depending upon device, is about 400x100. I have set the SDWebImage <em>imageContentMode</em> to .<em>widthFill</em>. I rotate the image to get it in the form I want for the tableview. I use it in it's regular orientation in other places.
  The first time my cells are shown the images are shown correctly. If I go back to the previous page, then show the same results in the table again, the visible cells will have their images no longer fitting correctly with regards to width, they are now too wide. If I scroll down hiding those cells all new cells are properly displayed, when I scroll back up the incorrect cells are now displaying correctly. Happens in simulator and actual phone.</p>
  
  <p>Here are the important parts of my UITableViewCell class :</p>
  
  <pre><code>class MyTableCell: UITableViewCell {
  var ski : Ski!
  var skiImageView: UIImageView = UIImageView()
  @IBOutlet weak var skiImageScrollView: ImageScrollView!
  
  
   func configureCell(ski: Ski) {
      self.ski = ski
      let imageUrl = ski.imageUrl!
      let url = URL(string: imageUrl)
       skiImageView.sd_setImage(with: url, placeholderImage: placeholderImage, options: [.retryFailed, .continueInBackground]
          , completed: {
              (image, error, cacheType, url) in
              if (error != nil) {
                  print("ConfigureCell Error : \(error!)")
                  return;
              }
              let rotatedImage = self.imageRotatedByDegrees(oldImage: image!, deg: 90.0)
              self.skiImageScrollView.display(image: rotatedImage)                var image = self.skiImageView.image!
              self.skiImageScrollView.imageContentMode = .widthFill
  
      })
  </code></pre>
  
  <p>}</p>
  
  <pre><code>func imageRotatedByDegrees(oldImage: UIImage, deg degrees: CGFloat) -&gt; UIImage {
      //Calculate the size of the rotated view's containing box for our drawing space
      let rotatedViewBox: UIView = UIView(frame: CGRect(x: 0, y: 0, width: oldImage.size.width, height: oldImage.size.height))
      let t: CGAffineTransform = CGAffineTransform(rotationAngle: degrees * CGFloat.pi / 180)
      rotatedViewBox.transform = t
      let rotatedSize: CGSize = rotatedViewBox.frame.size
      //Create the bitmap context
      UIGraphicsBeginImageContext(rotatedSize)
      let bitmap: CGContext = UIGraphicsGetCurrentContext()!
      //Move the origin to the middle of the image so we will rotate and scale around the center.
      bitmap.translateBy(x: rotatedSize.width / 2, y: rotatedSize.height / 2)
      //Rotate the image context
      bitmap.rotate(by: (degrees * CGFloat.pi / 180))
      //Now, draw the rotated/scaled image into the context
      bitmap.scaleBy(x: 1.0, y: -1.0)
      bitmap.draw(oldImage.cgImage!, in: CGRect(x: -oldImage.size.width / 2, y: -oldImage.size.height / 2, width: oldImage.size.width, height: oldImage.size.height))
      let newImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
      UIGraphicsEndImageContext()
      return newImage
  }
  </code></pre>
  
  <p>Another strange thing is if I slap the back of my phone or drop it on my desk, the images will jump down so only parts of the top of my image are visible in the ImageScrollView, but callbacks from ImageScrollView for zooming are not activated, so no idea what is happening there either.</p>