Collection View 不称为 didSelectItemAtIndexPath 。当我将点击手势识别器添加到 collectionView super View 时,它总是响应点击手势方法。
请帮助我,在此先感谢!
Best Answer-推荐答案 strong>
试试这个
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
let touchPoint = touch.locationInView(superView)
return !CGRectContainsPoint(collectionView.frame, touchPoint)
}
并确保代理已连接:
tapGestureRecognizer.delegate = self
关于ios - UICollectionView:将点击手势识别器添加到 collectionView super View ,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/38009292/
|