Skip to content

Instantly share code, notes, and snippets.

@mhennemeyer
Created March 17, 2011 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhennemeyer/875256 to your computer and use it in GitHub Desktop.
Save mhennemeyer/875256 to your computer and use it in GitHub Desktop.
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRight:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeft:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
-(void)swipeLeft:(id)rec {
self.label.text = @"left";
}
-(void)swipeRight:(id)rec {
self.label.text = @"right";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment