Skip to content

Instantly share code, notes, and snippets.

@TiernanKennedy
Last active December 13, 2015 18:18
Show Gist options
  • Save TiernanKennedy/4954189 to your computer and use it in GitHub Desktop.
Save TiernanKennedy/4954189 to your computer and use it in GitHub Desktop.
Adding a gesture recognizer
// first add a clear button that covers the screen
// Now add a gesture recognizer in ViewDidLoad
// with target "self" (this class)
// and selector (method) "hideCamera"
UISwipeGestureRecognizer* upSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(hideCamera)];
// set the direction of the swipe to up
[upSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionUp];
// add the gesture recognizer to your new button
[self.myButton addGestureRecognizer:upSwipeRecognizer];
// here is the method we call
-(void) hideCamera
{
NSLog(@"hide camera");
self.cameraWebView.hidden = TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment