I\'m easily able to change the background color of a cell in the CellForItemAtIndexPath
method
func collectionView(collectionView: UICollectionView,
You can override UICollectionViewCell isSelected . It will apply changes in selected method.
class ButtonCollectionCell: UICollectionViewCell {
override var isSelected: Bool{
didSet{
if self.isSelected
{
self.layer.backgroundColor = colorLiteral(red: 0.8058760762, green: 0.2736578584, blue: 0.1300437152, alpha: 1)
} else
{
self.layer.backgroundColor = colorLiteral(red: 0, green: 0, blue: 0, alpha: 0)
}
}
}
}