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

  • Home
  • SEARCH
  • 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 6081657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:12:02+00:00 2026-05-23T11:12:02+00:00

I have a UIScrollView . On top of it I put a UIImageView with

  • 0

I have a UIScrollView. On top of it I put a UIImageView with an Image in it. Now I added another UIView on top of this UIImage view. On this UIView I d like to add some Annotations. So I d like to be able to press down one finger for 3 seconds and then there should appear some kind of an icon at the position where i pressed the finger. The Idea is that this icon shows up over the image which is set in the ImageView.

Now the problem is when I zoom the Image which has been set in UI Image View then the icon gets somehow rearranged but it doesnt stays at the position it originally was.

Example: I d like to load a picture of a bone where there is an area which might be a cancer. If I know add the annotation Icon to the position where I think there might be the cancer and rezoom the bone afterwards, the icon isnt anymore at the position where I initially marked it.

Does anyone have an idea what I have to do?

Code Extract from UIView where I d like to draw annotation icons

(void)drawRect:(CGRect)rect {
    CGContextRef contextRef = UIGraphicsGetCurrentContext();

    //DRAW PIN IMAGE
    if(clickPosition.x > 0){
        NSLog(@"REACHED...");
        UIImage *pin = [UIImage imageNamed:@"Icon_Annotation10.png"];
        CGRect pinrect = CGRectMake(clickPosition.x, clickPosition.y, 30, 30);    
        CGContextDrawImage(contextRef, pinrect, pin.CGImage);//draws image in context
    }
}

Settings for ScrollView

// settings for scroll view
scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);
scrollView.maximumZoomScale = 4.0;
scrollView.minimumZoomScale = 0.75;
scrollView.clipsToBounds = YES;
scrollView.userInteractionEnabled = YES;
scrollView.delegate = self;
scrollView.scrollEnabled = NO;
  • 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-23T11:12:02+00:00Added an answer on May 23, 2026 at 11:12 am

    I believe you need to multiply clickPosition.x and clickPosition.y by the scale of the zoom.

    You can get the scale by implementing the following UIScrollViewDelegate method

    - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
    

    scale in this context will be a value between the minimumZoomScale & maximumZoomScale you set.

    You then need to pass this to the view which draws the pin. The best way would probably be to have a zoomScale property on the view, and then in the delegate method above set that property to the new scale value and redraw the contents of the view.

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

Sidebar

Related Questions

I have a UIViewController, on top I put an UIImageView, then a UIScrollView. I
From top to bottom I have UIView, UIScrollView, a UIImage, a UILabel, a UITextView
I am trying to add the UIButton to UIScrollView . I have added the
I have a UIScrollView which contains a view (lets call this main view) which
I have an image inside an UIImageView which is within a UIScrollView. What I
I currently have a UIView / UIScrollView that is displayed within a modal view.
I have a UIScrollView decendent that implements a takeScreenshot method that looks like this:
I have successfully implemented a working UIScrollView layer on top of Cocos2d using this
I have UIScrollView in my view. Problem is that if I slightly scroll it
I have a UIScrollView that contains an image and a segmented control that allows

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.