У меня есть пользовательская реализация UITableViewCell. UITableViewCell можно прокручивать влево или вправо. Я использую UIPanGestureRecognizer для этого же.проведите пальцем по одному пальцу и проведите пальцем по одному подклассу UIView
UIGestureRecognizer* recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
recognizer.delegate = self;
[self addGestureRecognizer:recognizer];
}
#pragma mark - horizontal pan gesture methods
-(BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer {
CGPoint translation = [gestureRecognizer translationInView:[self superview]];
// Check for horizontal gesture
if (fabsf(translation.x) > fabsf(translation.y)) {
return YES;
}
return NO;
}
-(void)handlePan:(UIPanGestureRecognizer *)recognizer {
if (recognizer.state == UIGestureRecognizerStateBegan) {
// if the gesture has just started, record the current centre location
// SOME CODE
}
if (recognizer.state == UIGestureRecognizerStateChanged) {
// translate the center
//SOME CODE
}
if (recognizer.state == UIGestureRecognizerStateEnded) {
// the frame this cell would have had before being dragged
//SOME CODE
}
}
Теперь я хочу, чтобы иметь возможность поддерживать два пальца на на весь экран, что даже если два пальца делается на UITableViewCell, приведенный выше код не срабатывает. Как я могу это достичь?
Вы уверены, что ваш «Проверка горизонтального жеста» логика верна? – sunkehappy