2016-09-06 22 views
0

我有一個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這個標誌值,如果它符合你的條件,那麼改變圖像不然,它是一樣的,希望你明白了我的觀點! –

回答

0

我想通了!

改變我的牢房聲明此

let cell = collectionView.cellForItemAtIndexPath(indexPath)