Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Created July 23, 2019 01:33
Show Gist options
  • Save hanfengs/8584b7f54c4065b06f34c76326d07f23 to your computer and use it in GitHub Desktop.
Save hanfengs/8584b7f54c4065b06f34c76326d07f23 to your computer and use it in GitHub Desktop.
[滑动手势]
UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[self.view addGestureRecognizer:recognizer];
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer{
if(recognizer.direction == UISwipeGestureRecognizerDirectionDown) {
NSLog(@"swipe down");
}
if(recognizer.direction == UISwipeGestureRecognizerDirectionUp) {
NSLog(@"swipe up");
}
if(recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
if (self.isNext && self.scoreModel) {
[self clickNextBtn:nil];
}
}
if(recognizer.direction == UISwipeGestureRecognizerDirectionRight) {
NSLog(@"swipe right");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment