Reputation: 17393
I would like to use didSelectItemAtIndexPath
but it doesn't work.
collection_contactus.allowsSelection = true
collection_options.allowsSelection = true
collection_options!.dataSource = self
collection_options!.delegate = self
collection_contactus!.dataSource = self
collection_contactus!.delegate = self
func collectionView(_ collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("test")
// if(collectionView == collection_options)
// {
//
// }else{
// print("test: \(indexPath)")
// }
}
I can't see any output.
Upvotes: 1
Views: 484
Reputation: 52213
I think you are using Swift 3.2. That method was renamed to collectionView(_:didSelectItemAt:)
in Swift 3.0:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
...
}
Upvotes: 1