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 8487227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:10:41+00:00 2026-06-10T21:10:41+00:00

I just do a sample to check the pan gesture. The pan gesture is

  • 0

I just do a sample to check the pan gesture.

The pan gesture is detecting and working fine.

But whenever i give a secondPoint in the pan gesture like CGPoint secondPoint = [sender locationOfTouch:1 inView:self.imageView]; it is crashing.

The console is giving the message

 *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UIPanGestureRecognizer locationOfTouch:inView:]: index (1) beyond bounds (1).'

When I use panGestureRecognizer.maximumNumberOfTouches = 1;
panGestureRecognizer.minimumNumberOfTouches =1; still it is crashing.

When I use panGestureRecognizer.maximumNumberOfTouches = 2;
panGestureRecognizer.minimumNumberOfTouches = 2;
then it is not entering into the

- (void)panGestureHandler:(UIPanGestureRecognizer *)sender method.

Can anyone please guide me where im going wrong.

Thanks in advance.Hoping for your help.

I tried in this way.

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGestureHandler:)];
     panGestureRecognizer.maximumNumberOfTouches = 2;
     [self.imageView addGestureRecognizer:panGestureRecognizer];

}
- (void)panGestureHandler:(UIPanGestureRecognizer *)sender
{
    if ([sender state] == UIGestureRecognizerStateBegan )
    {
        CGPoint firstPoint = [sender locationOfTouch:0 inView:self.imageView];
        CGPoint secondPoint = [sender locationOfTouch:1 inView:self.imageView];
    }
    else if ([sender state] ==UIGestureRecognizerStateEnded ) 
    {
    }

}
  • 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-06-10T21:10:43+00:00Added an answer on June 10, 2026 at 9:10 pm

    You provided a maximumNumberOfTouches, but no minimumNumberOfTouches. I.e., the gesture can be recognized after the first touch. In this case, no second touch may exist, and your index 1 (referring the second element) exceeds the array bounds.

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

Sidebar

Related Questions

The sample program that comes with the Extension Library works just fine, but when
I don't know how to explain this correctly but just some sample for you
Ok, I've got a list like this (just a sample of data): data =
Just going through the sample Scala code on Scala website, but encountered an annoying
I had the sample facebook login implementation, and just realized that it stopped working:
I've just build a sample application to test out google app engine and google
I've just found a great sample of Facebook Connect on Blackberry by Eki Y.
I'm just learning Swing, and built a sample GUI for myself as practice. Very
I am trying to create this tooltip sample for my wordpress it works just
Apple just released some sample code on lazy loading images in a UITableView a

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.