ios UICollectionView cell selecting and deselecting issue
问题 Im using UIcollection view as my tabbar when I scroll collection view horizontally previous selected cell will not deselect when i select new one this is my code to change colour when i select a cell and deselect a cell var selectedIndexPath : IndexPath = [] func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if let cell = collectionView.cellForItem(at: indexPath) as? BottomCollectionViewCell { cell.contentView.backgroundColor = UIColor.orange cell