2015-02-08 78 views
0

我在CollectionView上有一個按鈕,用於爲CollectionView上的標籤設置動畫(將它們向前滑動回&)。我想知道是否可以使用相同的按鈕爲單元格上的標籤製作動畫。iOS Swift:從CollectionView上的按鈕動畫CollectionViewCell元素

我正在考慮將collectionView:performAction作爲一種可能的解決方案,但是我想在獲取一些可能無法解決的問題之前花費太多時間來獲得其他一些想法。

回答

1

賓果:

for item in self.collectionView!.visibleCells() as [UICollectionViewCell] { 
     var indexpath : NSIndexPath = self.collectionView!.indexPathForCell(item as CollectionViewCell)! 
     var cell : CollectionViewCell = self.collectionView!.cellForItemAtIndexPath(indexpath) as CollectionViewCell 

     //access cell data 
     println(cell.labelName.text) 
    } 

發現here