HomeCollectionViewを長押ししたときに、HomeCollectionViewCellコントローラのisEditableプロパティを変更したいとします。ただし、cellForItemAtIndexPathメソッドでのみ設定できます。 handleLongPressメソッドでそれらを設定したいと思います。私のUICollectionViewCellのプロパティを変更するには?
func editVideoFiles(sender: UILongPressGestureRecognizer) {
if sender.state == UIGestureRecognizerState.Began{
let p:CGPoint = sender.locationInView(self.collectionView)
let index: NSIndexPath = self.collectionView.indexPathForItemAtPoint(p)!
if let cell = self.collectionView.cellForItemAtIndexPath(index) {
//cell is the UICollectionViewCell, I do not know how to set the isEditable property by this.
}
}
}
ありがとうございます!しかし私はすべての私の目に見える細胞の特性を設定したい。 collectionView.visibleCells()でセルを使用すると、CellをHomeCollectionViewCellにキャストできません。どうすればいいか教えてください。 – leuction
私はその問題を解決しました。セル(self.collectionView.visibleCells()?[HomeCollectionViewCell])内のセルのためだけに言ってください! – leuction