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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:52:22+00:00 2026-06-06T22:52:22+00:00

I have a UIScrollview with a UIImageview inside it showing a floor plan. I

  • 0

I have a UIScrollview with a UIImageview inside it showing a floor plan. I also have a UIButton within the scrollview that acts as a marker/pin.

I have implemented zooming with pinching/double tapping on the image, but the UIButton element obviously doesn’t move when the image scrolls and/or zooms.

I have tried the following code to try and resposition the button when a zoom is completed:

[myButton setFrame:CGRectMake(
                          (myButton.frame.origin.x - myButton.frame.size.width / 2) * _scrollView.zoomScale,
                          (myButton.frame.origin.y - myButton.frame.size.height / 2) * _scrollView.zoomScale,
                          myButton.frame.size.width, myButton.frame.size.height)];

This moves the button to the top left hand corner.

Has anyone got any idea of what I should be doing to keep the button relative to the image (the same way a marker does on a Google map).

  • 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-06T22:52:23+00:00Added an answer on June 6, 2026 at 10:52 pm

    Ok well this was solved by the following:

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:@"Marker.png"] forState:UIControlStateNormal];
    button.frame = CGRectMake(640.0, 230.0, 30.0, 46.0);
    [button addTarget:self action:@selector(aMethod:)forControlEvents:UIControlEventTouchUpInside];
    [self.imageView addSubview: button];
    self.imageView.userInteractionEnabled = YES;
    

    Basically by adding the button to the imageView directly and then enabling userInteraction, I was able to get all the functionality needed.

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

Sidebar

Related Questions

I have a UIImageView that is housed inside a UIScrollView . The image in
I have an image inside an UIImageView which is within a UIScrollView. What I
I have an UIImageView inside an UIScrollView. I want that the user can zoom
i have an uiscrollview with a uiimageview inside. I subclass the uiscrollview but i
I have a uiscrollview and there is a uiimageview inside it. I want the
I have a UIImageView inside of a UIScrollView. The parent scroll view allows zooming
I have a UIScrollView containing a UIImageView. now I also added a two finger
I have several UIViews and UIImageViews that are loaded inside a UIScrollView. Each page,
I have a UIScrollView loaded with a UIImageView, so that the user can zoom
I have a uiscrollview and i am showing some dynamically generated uiimageview over 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.