Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7173369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:48:36+00:00 2026-05-28T15:48:36+00:00

I have a 2d map that the user can zoom and pan using the

  • 0

I have a 2d map that the user can zoom and pan using the gesture recognizers. While it works, i want the user to start panning immediately after a zoom once they have 1 finger lifted. Unfortunately, in the docs it says:

The gesture ends (UIGestureRecognizerStateEnded) when both fingers
lift from the view.

which is pretending me from going from a pinch zoom to a pan right away. What could i do to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:48:37+00:00Added an answer on May 28, 2026 at 3:48 pm

    This is possible, and easy! It involves being your gesture recognizer’s delegate. Something no-one seems to know exists. In my view controller subclass I have declared both conforming to the protocol <UIGestureRecognizerDelegate> and two ivars:

    UIPinchGestureRecognizer *myPinchGR;
    UIPanGestureRecognizer *myPanGR;
    

    These ivars are instantiated in view did load. Notice setting self as the delegate.

    -(void)viewDidLoad{
        [super viewDidLoad];
        myPanGR = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panTarget:)];
        myPanGR.delegate = self;
        [self.view addGestureRecognizer:myPanGR];
    
        myPinchGR = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchTarget:)];
        myPinchGR.delegate = self;
        [self.view addGestureRecognizer:myPinchGR];
    }
    

    One of the delegate calls made by a UIGestureRecognizer is shouldRecognizeSimultaneouslyWithGestureRecognizer: if I had more than two gesture recognizers then this function would have to contain some logic. But since there are only two I can just return YES.

    -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
        return YES;
    }
    

    Now you do have to include a little (very little) extra logic in your action methods to screen for the appropriate conditions.

    -(void)panTarget:(UIPanGestureRecognizer *)panGR{
        if (panGR.numberOfTouches > 1) return;
        NSLog(@"panny");
    }
    -(void)pinchTarget:(UIPinchGestureRecognizer *)pinchGR{
        if (pinchGR.numberOfTouches < 2) return;
        NSLog(@"pinchy");
    }
    

    Run this code an look at the logs. you will see when you move one finger you will see “panny” when you place a second finger down you will see “pinchy”, and back and forth.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an UIImageView inside an UIScrollView. I want that the user can zoom
i have a map (just an image) and i want that a user can
I have a map that represents a DB object. I want to get 'well
I want to have a map that has a homogeneous key type but heterogeneous
I have a std::map that I'm using to store values for x and y
I have a Map, that I want to persist. The domain object is something
I have Java Map (out of Strings and Ints) objects that I want to
I want to build an image scroller that works like google map. When the
I have a map that dispays markers. If the user clicks on a marker
My app is using a ListFragment on left side that the user can use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.