我有一个ViewController中的UICollection视图,它根本没有响应didSelectItemAtIndexPath。Swift UICollectionView:didSelectItemAtIndexPath没有响应
// super class
class ViewController: UIViewController, iCarouselDelegate, iCarouselDataSource, UICollectionViewDelegate, UICollectionViewDataSource {
@IBOutlet weak var collectionView: UICollectionView!
// delegate
override func viewDidLoad() {
super.viewDidLoad()
// collection view delegate and datasource
collectionView.delegate = self
collectionView.dataSource = self
// did select item
func collectionView(collectionView: UICollectionView!, didSelectItemAtIndexPath indexPath: NSIndexPath!) {
print(indexPath)
}
嘿,我想知道是否有在细胞中的任何按钮。或者customCell的内容是什么? –
当我发布问题我没有按钮,只是图像和标签。 现在我已经回答了这个问题,我如何解决这个问题。 去检查我的回答 –