If you do not want the syntax gluing gesture to be performed simultaneously with the scroll gesture in the form of a table, add a panorama gesture to your cell and make it a delegate:
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(doPan:)]; pan.delegate = self; [self addGestureRecognizer:pan];
And implement the following delegate method just to run if the panorama is horizontal:
#pragma mark - UIGestureRecognizerDelegate - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { // note: we might be called from an internal UITableViewCell long press gesture if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { UIPanGestureRecognizer *panGestureRecognizer = (UIPanGestureRecognizer*)gestureRecognizer; UIView *cell = [panGestureRecognizer view]; CGPoint translation = [panGestureRecognizer translationInView:[cell superview]]; // Check for horizontal gesture if (fabs(translation.x) > fabs(translation.y)) { return YES; } } return NO; }
Swift3 ..
override func awakeFromNib() { super.awakeFromNib() // do not use, say, layoutSubviews as layoutSubviews is called often let p = UIPanGestureRecognizer(target: self, action:
source share