AlamofireImage af_setImageWithURL in a UITableViewCell without placeholder image

后端 未结 2 1673
长发绾君心
长发绾君心 2021-02-20 04:11

I\'m using AlamofireImage to set an image on a UIImageView in a UITableViewCell like so:

cell.imageView.af_setImageWithURL(url)

The image doesn\'t

2条回答
  •  遥遥无期
    2021-02-20 05:04

    You can print the error by adding 2 line of code so that you will get more Idea about the issue.

    cell.imageView.af_setImageWithURL(URL, placeholderImage: UIImage(named: "placeholder"), filter: nil, imageTransition: .None, completion: { (response) -> Void in
                        print("image: \(cell.imageView.image)")
                        print(response.result.value) //# UIImage
                        print(response.result.error) //# NSError
    
                    })
    

    In my case there was an issue with Image URL. It was downloading the image when I open it in browser.

提交回复
热议问题