UICollectionView didSelectItemAtIndexPath实现方法

didSelectItemAtIndexPath是通过UIResponder的四个touch方法实现的(touchBegan, touchMove, touchEnd, touchCancel)因此当给UICollectionView添加手势识别时(如tap手势),手势识别成功后touch事件会被取消掉,导致didSelectItemAtIndexPath无法调用,解决办法是将手势识别的cancelTouchesInView属性设为NO,即手势识别成功之后依然继续发送touch事件。

猜你喜欢

转载自www.cnblogs.com/yibinpan/p/10755920.html