natelyman / SwiftImageLoader

Asynchronous Image Loader in Swift. Caches using an NSCache.
MIT License
177 stars 42 forks source link

Loading images in tableview doesn't show automatically #2

Open aramikg opened 10 years ago

aramikg commented 10 years ago

I'm running into loading issues when using this. For example, I call

ImageLoader.sharedLoader.imageForUrl(urlString, completionHandler:{(image: UIImage?, url: String) in self.imageView.image = image })

in cellForRowAtIndexPath and it doesn't show up until you basically touch/move the tableview then it populates with the images. Am I missing something or doing something wrong?

Screon commented 9 years ago

You need to get cell after image is loaded.

ImageLoader.sharedLoader.imageForUrl(urlString, completionHandler:{(image: UIImage?, url: String) in
   if let cell = tableView.cellForIndexPath(indexPath) {
      cell.imageView.image = image
   }
})