1
didSelectItemAtIndexPath
を使用したいと思いますが、動作しません。CollectionView didSelectItemAtIndexPathが機能しません - Swift
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)")
// }
}
これは私のクラスの全体です:
https://paste.ofcode.org/HYhLpnDFQFaNfma8LKGdZp
私は任意の出力を参照してください傾けます。
正しいメソッドのシグネチャを使用すると、多くのことをするのに役立ちます。 – rmaddy