Search code examples
swiftuitableviewios8xcode6.4haneke

UITableViewCell images are resized when scrolling


I used HanekeSwift to set the images in my UITableViewCell in cellForRowAtIndexPath. My code below works but the images are resized when I start scrolling through the list. How can I prevent the images from resizing?

//Load pet image
var petImage : String = pet["pet_image"] as! String
var petUrl = NSURL(string: petImage)
var cellImageView = cell.imageView
cellImageView?.hnk_setImageFromURL(petUrl!, format: Format<UIImage>(name: "original")) 

Here are my screenshots:

First load: https://dl.dropboxusercontent.com/u/10131270/first-load.png

After scrolling: https://dl.dropboxusercontent.com/u/10131270/after-scrolling.png


Solution

  • Try setting the contentMode property on the cellImageView to UIViewContentModeScaleAspectFit