-
-
Save anka/ae9f6ae2409014cd840b to your computer and use it in GitHub Desktop.
iOS register swipe gesture recognizer for a UITableView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
self.title = @"Your controller title"; | |
//Add a left swipe gesture recognizer | |
UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self | |
action:@selector(handleSwipeLeft:)]; | |
[recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)]; | |
[self.tableView addGestureRecognizer:recognizer]; | |
[recognizer release]; | |
//Add a right swipe gesture recognizer | |
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self | |
action:@selector(handleSwipeRight:)]; | |
recognizer.delegate = self; | |
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)]; | |
[self.tableView addGestureRecognizer:recognizer]; | |
[recognizer release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment