1

我有一个CollectionView,其单元格是BubbleNode: ASCellNode.

我使用翠鸟作为我的主要ImageDownloaderImageCache. 我有一个 imageView,我将它包裹在一个ASDisplayNodewith 中initWithViewBlock:

init() {
    // ...
    imageNode = ASDisplayNode(viewBlock: {
        let imageView = UIImageView()
        imageView.kf_setImageWithURL(url, placeholderImage: nil, optionsInfo: [KingfisherOptionsInfoItem.CacheMemoryOnly], progressBlock: nil, completionHandler: nil)
        imageView.clipsToBounds = true
        imageView.layer.cornerRadius = 12
        imageView.backgroundColor = UIColor.redColor()
        return imageView
    })
    addSubnode(imageNode)
    // ...
}

第一次,图像下载并正确显示,但滚动和重新显示后,图像消失了,只显示背景颜色。

重点是当我点击矩形时,它会显示图像!

图片

4

1 回答 1

0
let cell = tableView.dequeueReusableCell(withIdentifier: "AnswerCell", for: indexPath) as! CustomAnswerViewCell

对你的细胞使用这种方法

...

//Download image
                if UIImage(named: "no-image-found") == question.questionImage {
                    //cell.downloadImage(imageName: question.imageName)

                    if let url = URL(string: serverString+"photo?filename="+question.imageName) {
                        headerCell.questionImageView.kf.setImage(with: url)
                        //question.questionImage = headerCell.questionImageView.image
                        headerCell.questionImageView.contentMode = .scaleAspectFit
                    } else {
                        print("Bad url")
                    }
                }
于 2016-10-08T08:35:28.510 回答