1

I'm pretty new to Swift and I have a question, I have a collection view, with a cell inside, and a label inside of this cell. I created an array and returned it, so I have multiple cells with labels. My question is, how to change a color of specific labels, for example if I want the labels "2", "7", "13"(from the image) and etc to be not green, but other color. THANK YOU screen of simulator

Adley
  • 9
  • 1

1 Answers1

1

Implement method below and set desired colour.

func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
    // Access label of cell object and set desired colour
}

Tells the delegate that the specified cell is about to be displayed in the collection view.

https://developer.apple.com/reference/uikit/uicollectionviewdelegate/1618087-collectionview

nspavlo
  • 377
  • 3
  • 12