使用Swift更改imageTap手势识别选择器方法中的UICollectionViewcell内容

问题描述:

我有一个CollectionViewCell并将tapGestureRecognizer动作设置为底部页面(小图像)上的缩略图图像。我想让方法改变我的大图像,但如何访问我的细胞的内容?我曾经尝试这样做,我得到了IMAGEURL和我得到了indexPath但我没有改变我的单元格的内容使用Swift更改imageTap手势识别选择器方法中的UICollectionViewcell内容

Sample Screenshoot

func tapThumbnail(sender: UITapGestureRecognizer){ 
    let thumbnail = sender.view as! UIImageView 
    let url = thumbnail.sd_imageURL() as! NSURL 

    let point = sender.locationInView(self.collectionView) 
    let indexPath = self.collectionView!.indexPathForItemAtPoint(point) 


    let cell = self.collectionView!.dequeueReusableCellWithReuseIdentifier(productsIdentifier, forIndexPath: indexPath!) as! ProductsSpotlightViewCell 
    cell.productImage.sd_setImageWithURL(url) 
} 

任何1有简单的解决办法?

+0

每当ü挖掘它只是设置标志值,然后重新加载的CollectionView和cellForRow方法,CHCK这个标志值,如果它符合你的条件,那么改变图像不然,它是一样的,希望你明白了我的观点! –

我想通了!

改变我的牢房声明此

let cell = collectionView.cellForItemAtIndexPath(indexPath)