你好,请教一问题
Closed this issue · 2 comments
sd1435728 commented
我在使用3dtouch配合UICollectionView时候发现当内容数量到一定大小时候就会出现点击失败的问题
,这个问题在你的代码中同样会出现,具体表现为 NSIndexPath *indexPath = [_collectionView indexPathForItemAtPoint:location];
无法获得正确地点,我试过你的这个demo,当我设置数组有68个元素出现了该问题,不知道你有没有什么好的解决办法?
boolean93 commented
感谢您的 issue。
我刚刚调试了一下,发现主要的问题是出在indexPathForItemAtPoint:
这个方法的参数 location 是相对于整个 scrollView的,而传进来的 location 是相对于屏幕的。所以就有了偏差。
目前想到的解决方法:
- 将collectionView的scroll的高度加给location,这样就可以获得正确的cell了。
- sourceRect的地方也做相应偏移量的调整
boolean93 commented
OK,手动做了计算,已经没问题了。详看我的这次 commit