I have a UIView which covers all of a UITableView. The UIView is using gesture recognizers for control of what the table displays. I still need the vertical UITableView scrollin
Assign your gesture to the table view and the table will take care of it:
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSwipeFrom:)];
[gesture setDirection:
(UISwipeGestureRecognizerDirectionLeft
|UISwipeGestureRecognizerDirectionRight)];
[tableView addGestureRecognizer:gesture];
[gesture release];
Then in your gesture action method, act based on the direction:
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer {
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
[self moveLeftColumnButtonPressed:nil];
}
else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) {
[self moveRightColumnButtonPressed:nil];
}
}
The table will only pass you the gestures you have asked for after handling them internally.