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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:55:31+00:00 2026-05-20T19:55:31+00:00

I have a UIScrollView and inside it there is a UIImageView with an image.

  • 0

I have a UIScrollView and inside it there is a UIImageView with an image. I would like to be able to zoom and still be able to get the coordinates of UIImage. My Image has coordinates bigger than iPhone screen 600×800 and with the current method, i only get the coordinates on the iPhone screen. How can I get the coordinates of the actual place on the UIImage that has been tapped?

This is what I’ve got so far:

- (void) loadView {

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)];
tapGesture.numberOfTapsRequired = 1;
tapGesture.numberOfTouchesRequired = 1;


UIImage *mapImage = [UIImage imageNamed:@"Map1.png"];
imageV = [[UIImageView alloc] initWithImage:mapImage];
//imageV.userInteractionEnabled = YES;

//[imageV addGestureRecognizer:tapGesture];

//CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
scrollV = [[UIScrollView alloc] initWithFrame:imageV.frame];
scrollV.contentSize = CGSizeMake(imageV.frame.size.width, imageV.frame.size.height);

[scrollV addGestureRecognizer:tapGesture];

[scrollV addSubview:imageV];
scrollV.userInteractionEnabled = YES;
scrollV.maximumZoomScale = 5;
scrollV.minimumZoomScale = 0.5;
scrollV.bounces = NO;
scrollV.bouncesZoom = NO;
scrollV.delegate = self;

self.view = scrollV;

}



-(void)tapDetected:(UIGestureRecognizer*)recognizer{
NSLog(@"tap detected.");
CGPoint point = [recognizer locationInView:nil];

NSLog(@"x = %f y = %f", point.x, point.y );
}

-(UIView*) viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [[self.view subviews] objectAtIndex:0];
}
  • 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-20T19:55:32+00:00Added an answer on May 20, 2026 at 7:55 pm

    I just figured out that the uitapgesture recognizer should be added to the UIImageView and when the method tapDetected is being called, the right way to get the location is to give it the right view as below

    CGPoint point = [recognizer locationInView:self.imageV];
    

    Then it is possible to get the coordination from the image.

    • 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 an UIImageView with an image (map) inside of a UIScrollView. I add
I have a UIImageView inside of a UIScrollView. The parent scroll view allows zooming
I have a UIScrollView and added a UIView inside it, when I zoom it,
I have a UIScrollView that contains a UIView inside. The UIScrollView has paging enabled
So I have a UIViewController subclass called MyTabBarViewController that has a UIScrollView. Inside of
I have a Graph being drawn inside a UIScrollView . It's one large UIView
I have a scroll view which has one UIView inside which contains the content.
I have several UIViews and UIImageViews that are loaded inside a UIScrollView. Each page,
I have created a UIScrollView (canvas.scrollview) and have a custom UIView (canvas) inside it.

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.