views:

57

answers:

2
+1  Q: 

ipad page swipe

Is there a standard way to register either left or right swipes of the page and respond accordingly?

+1  A: 

You probably want the UISwipeGestureRecognizer Class Reference.

William Jockusch
+3  A: 

I don't know what you mean if you say page, but besides that there are UIGestureRecognizers. And there is a UISwipeGestureRecognizer as well. One not so obvious (at least it was for me) thing is that you have to create two of them, one for left and one for right swipe. Just add them to an UIView.

UISwipeGestureRecognizer *swipeLeftGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftGesture:)];
swipeLeftGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
[aView addGestureRecognizer:swipeLeftGestureRecognizer];
[swipeLeftGestureRecognizer release];

UISwipeGestureRecognizer *swipeRightGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightGesture:)];
[aView addGestureRecognizer:swipeRightGestureRecognizer];
[swipeRightGestureRecognizer release];

and in - (void)swipeLeftGesture:(UISwipeGestureRecognizer *)sender and - (void)swipeRightGesture:(UISwipeGestureRecognizer *)sender you can do whatever you want.

You should have a look at the UIGestureRecognizer Class Reference

fluchtpunkt
Thank you. No Idea how this escaped my knowledge base for so long.
emachine