Conflict between cell and horizontal scroll

I currently have a horizontal scroll that has multiple pages. Some of these pages have numbered tables.

The idea is to be able to swipe through a cell, and when it finishes this scroll, activate the scroll scroll to go to the next page. Something like that:

enter image description here

But when I try, it arises in conflict and 2 scrolls are activated at the same time. That is, while the cell moves and shows the button, the scroll also starts moving to another page.

For the swipe cell, I use SWTableViewCellbecause the built-in function is similar to the following:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
    }
}

Not even activated, they completely ignore the cell swipe and only activate scrolling.

, .

+4
3

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    return TRUE;
}
+2

try it

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if ([[otherGestureRecognizer.view class] isSubclassOfClass:[UITableView class]]) {
        if ([otherGestureRecognizer isKindOfClass: [UIPanGestureRecognizer class]]) {
            UIPanGestureRecognizer *otherPan = (UIPanGestureRecognizer *)otherGestureRecognizer;
            CGPoint translation = [otherPan translationInView:otherGestureRecognizer.view];
            return translation.x < 0;
        }
    }
    return NO;
}
0
source

Source: https://habr.com/ru/post/1648279/


All Articles