samson
samson

Reputation: 43

Swift 3: CollectionView didSelectItemAt get selected cell label

I've been struggling with this for awhile and can't find it answered elsewhere. Basically I need to edit a view inside the selected collection view cell. For example once a cell is clicked the label text inside that cell changes.

Here is what i need however it only works on tableviews

Upvotes: 3

Views: 7043

Answers (1)

Hussain Shabbir
Hussain Shabbir

Reputation: 15015

If I understand it correctly you need to get the selected collection view cell:-

if let cell = collectionView.cellForItemAtIndexPath(indexPath) {
 cell.textlabel.text = "yourtext"
}

Upvotes: 13

Related Questions