11

私は AlamofireImage を使用して、次のように UITableViewCell の UIImageView に画像を設定しています。

cell.imageView.af_setImageWithURL(url)

ダウンロード後、画像が表示されません。メモリ キャッシュから読み込まれた 2 回目の画像が表示されます。

プレースホルダー画像を使用すると、すべての違いが生じるようです。

これは機能し、(ダウンロードされた) イメージのアドレスを出力します。

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

これは機能せず、「image: nil」が出力されます

cell.imageView.af_setImageWithURL(URL, placeholderImage: nil, filter: nil, imageTransition: .None, completion: { (response) -> Void in
                    print("image: \(self.image)")
                })

実行する前にセルのimageViewを空の画像に設定するときにも機能しますaf_setImageWithURL:

cell.imageView.image = UIImage()

これはUITableViewCell、AlamofireImageのバグですか、それとも何か間違っていますか?

4

2 に答える 2