Navigation pop view when swipe right like Instagram iPhone app.How i achieve this?

Apple’s automatic implementation of the “swipe right to pop VC” only works for the left ~20 points of the screen. This way, they make sure they don’t mess with your app’s functionalities. Imagine you have a UIScrollView on screen, and you can’t swipe right because it keeps poping VCs out. This wouldn’t be nice. Apple … Read more

How to recognize swipe in all 4 directions?

You set the direction like this UISwipeGestureRecognizer *Swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(SwipeRecognizer:)]; Swipe.direction = (UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionDown | UISwipeGestureRecognizerDirectionUp); That’s what the direction will be when you get the callback, so it is normal that all your tests fails. If you had – (void) SwipeRecognizer:(UISwipeGestureRecognizer *)sender { if ( sender.direction | UISwipeGestureRecognizerDirectionLeft … Read more

Gesture problem: UISwipeGestureRecognizer + UISlider

The simplest way to handle this is probably to prevent the gesture recognizer from seeing touches on your slider. You can do that by setting yourself as the delegate, and then implementing – (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if ([touch.view isKindOfClass:[UISlider class]]) { // prevent recognizing touches on the slider return NO; } return YES; … Read more

Detect when UIGestureRecognizer is up, down, left and right Cocos2d

Apparently each UISwipeGestureRecognizer can only detect the swipe in the given direction. Even though the direction flags could be OR’ed together the UISwipeGestureRecognizer ignores the additional flags. The solution is to add one UISwipeGestureRecognizer for each direction you want the swipe gesture to be recognized, and set each recognizer’s direction accordingly to either up, down, … Read more

UIPanGestureRecognizer – Only vertical or horizontal

Just do this for the vertical pan gesture recognizer, it works for me: – (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer { CGPoint velocity = [panGestureRecognizer velocityInView:someView]; return fabs(velocity.y) > fabs(velocity.x); } And for Swift: func gestureRecognizerShouldBegin(_ gestureRecognizer: UIPanGestureRecognizer) -> Bool { let velocity = gestureRecognizer.velocity(in: someView) return abs(velocity.y) > abs(velocity.x) }