如何解决CollectionViewcell图像动画图像的问题?

我在CollectionView单元格中设置了动画图像,但是我 didSelectItemAt方法调用,但是如何隐藏隐藏的动画图像 问题,请参阅此video URL

let data:[UIImage] = images![indexPath.row] as! [UIImage]
cell.ivImage.animationImages = data
cell.ivImage.animationDuration = 1.0
cell.ivImage.startAnimating()

如何解决CollectionViewcell图像动画图像的问题?

zhouanneng 回答:如何解决CollectionViewcell图像动画图像的问题?

stickerCV.allowsSelection = false

收集单元格

let tap = UITapGestureRecognizer(target: self,action: #selector(self.handleTap(_:)))
            tap.accessibilityLabel = "\(indexPath.row),\(indexPath.section)"
            tap.numberOfTapsRequired = 1
            cell.ivSitcker.isUserInteractionEnabled = true
            cell.ivSitcker.addGestureRecognizer(tap)

点击手势

@objc func handleTap(_ sender: UITapGestureRecognizer) {
    let data = sender.accessibilityLabel?.components(separatedBy: ",")
    let index = Int(data![0])
    let section = Int(data![1])
    selectedIndex = index!
    let sectionData = AppData.sharedInstance.arrOfStickers[selectedStickerIndex]
    self.strSelectedSticker = sectionData[index!]
    self.createSticker(image: self.strSelectedSticker[0])
    self.selectedIndex = index!
    self.stickerCV.reloadData()
}
本文链接:https://www.f2er.com/2830619.html

大家都在问