pljhonglu / LewReorderableLayout

A UICollectionView layout whitch can move item with drag and drop.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

手势冲突的小问题

JianboYan opened this issue · comments

commented

如果某一行没有填满, 那么想要拖动整个view则会被gesture的delegate阻止掉, 导致这一部分拖动事件无法响应, 例如, 大图这一行个数的单数的情况下, 拖动右边的空白区域是无效的.
建议:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
if ([_panGesture isEqual:gestureRecognizer]) {
        if ([_longPress isEqual:otherGestureRecognizer]) {
            return YES;
        }else{
            // 这里原来直接返回NO, 可以根据是否选中了cell来判断
            CGPoint location = [gestureRecognizer locationInView:self.collectionView];
            return ![self.collectionView indexPathForItemAtPoint:location];
        }
....
}