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

问题描述 投票:0回答:1

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

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

enter image description here

imageview collectionview swift5
1个回答
0
投票
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()
}
© www.soinside.com 2019 - 2024. All rights reserved.