Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- guard let cell = collectionView.cellForItem(at: indexPath) as? CustomCell else {return}
- cell.label.textColor = .black
- indicatorViewLeadingConstraint.constant = (self.view.frame.width / 4) * CGFloat((indexPath.row))
- UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseOut, animations: {
- self.customTabBar.layoutIfNeeded()
- }, completion: nil)
- }
- func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
- guard let cell = collectionView.cellForItem(at: indexPath) as? CustomCell else {return}
- cell.label.textColor = .lightGray
- }
Add Comment
Please, Sign In to add comment