I am writing code to move two fingers up or down to change status. Code as below:
UISwipeGestureRecognizer *aSwipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; [aSwipeGesture setDirection:UISwipeGestureRecognizerDirectionUp | UISwipeGestureRecognizerDirectionDown]; aSwipeGesture.numberOfTouchesRequired = 2; [self.View addGestureRecognizer:aSwipeGesture]; - (void)swipeGesture:(UISwipeGestureRecognizer *)sender { NSLog(@"Swipe received."); if (sender.direction==UISwipeGestureRecognizerDirectionUp) { NSLog(@"swipe up"); } else if (sender.direction==UISwipeGestureRecognizerDirectionDown) { NSLog(@"swipe down"); } }
However, the only print magazine I could get was Swipe, obtained as shown below. I couldnβt get a message to scroll or scroll down, did I miss something? Thanks
ViewController.m:228 Swipe received. ViewController.m:228 Swipe received. ViewController.m:228 Swipe received. ViewController.m:228 Swipe received. ViewController.m:228 Swipe received. ViewController.m:228 Swipe received.
Updated: I have to use two fingers to complete the swipe action.
ios uigesturerecognizer uiswipegesturerecognizer
Sonny Parlin Apr 24 '13 at 6:07 2013-04-24 06:07
source share