Closed zacgibson21 closed 5 years ago
Have you assigned the delegate property of the collection view in question? A structure something like:
class MainViewController:UIViewController, UICollectionViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// set the delegate to self - this doesn't have to be in viewDidLoad, just wherever you are setting
// up the collection view's properties.
collectionView.delegate = self
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("Please Print!!")
}
// rest of the class code including
// other UICollectionViewDelegateMethods...
}
@zacgibson21 Have you solved this yet? Or are you still having trouble?
Closing due to inactivity. Let us know if you still are having this issue.
I can not for the life of me get the click function working on a collectionView. I have tried adding the below close to both my cell class and the main view controller with no luck.
CardPartCollectionViewDelegte { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { print("Please Print!!") }
Any advice would be appreciated