In my TableViewCell
I am using this method to retrieve URLS from my server, then I create a thumbnail image a video, finally inserting it into an UIImageView
.
var URL: String? {
didSet {
if gotThumb == false {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), {
let videoUrl = NSURL(string: Somelink )
let asset = AVAsset(URL: videoUrl!)
let assetImgGenerate = AVAssetImageGenerator(asset: asset)
assetImgGenerate.appliesPreferredTrackTransform = true
let time = CMTimeMake(asset.duration.value / 3, asset.duration.timescale)
dispatch_async(dispatch_get_main_queue(), {
if let cgImage = try? assetImgGenerate.copyCGImageAtTime(time, actualTime: nil) {
self.thumbImageView.hnk_setImage(UIImage(CGImage: cgImage), key: "\(self.thumbImageView.tag)", placeholder: nil, format: nil, success: { (image) -> () in
print("Got Thumb")
self.thumbImageView.image = image
self.gotThumb = true
})
}
})
})
} else {
print("Already have an image")
}
print(URL!)
}
}
As my title states. Haneke is only caching the first three images that are created by the above method. What happens is that no matter how many ImageViews
I have in my TableView
they are all being populated with the first three images
I am quite stuck on how to resolve this issue.