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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:30:31+00:00 2026-06-13T00:30:31+00:00

Trying to zoom in / out an imageView. i’ve managed that successfully so now

  • 0

Trying to zoom in / out an imageView.

i’ve managed that successfully so now i’m trying to place some buttons on the view and when button tapped to zoom on that area.

How can i implement that?

here is my code so far

-(void)zoomHere:(UIButton *)sender{

    NSLog(@"zoom in");
    //[self performSelector:@selector()
    //         withObject:nil
    //         afterDelay:1.6f];


    CGAffineTransform transformer = CGAffineTransformScale(imageView.transform, 1.05, 1.05);



    if (transformer.a < 5) {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration: 0.2];
        imageView.transform = transformer;
        [UIView setAnimationDelegate:self];
        [UIView commitAnimations];
    }


}

and the view did load

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIView *buttonView = [[UIView alloc]initWithFrame:CGRectMake(00.0, 20.0, 768, 1004.0)];

    zoomHere = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [zoomHere addTarget:self
               action:@selector(zoomHere:)
     forControlEvents:UIControlEventTouchDown];
    [zoomHere setTitle:@"ZoomIN" forState:UIControlStateNormal];
    zoomHere.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
    [buttonView addSubview:zoomHere];

    buttonView.multipleTouchEnabled = YES;

    [self.view addSubview:buttonView];


}

It still zoom in but not on that area where the button sits on screen!

  • 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-13T00:30:33+00:00Added an answer on June 13, 2026 at 12:30 am

    if you want to use scale transform, you probably should use translate transform as well
    like this:

    CGAffineTransform scale = CGAffineTransformMakeScale(1.05, 1.05);
    CGAffineTransform translate = CGAffineTransformMakeTranslation(10, 20);
    CGAffineTransform delta = CGAffineTransformConcat(scale, translate);
    imageView.transform = CGAffineTransformConcat(imageView.transform, delta);
    

    this is how you know the position of button on your image view:

    [imageView convertPoint:button.center fromView:self.view]
    

    so if you know button’s coordinates and your current scale then you can calculate new translate transform
    But as for me, i would rather use scroll view to zoom in and zoom out that image view. You can have nice bouncing animations and zooming animations, also you can have pan and pinch, but of cource it is up to you.

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

Sidebar

Related Questions

I am trying to add some functionality that will zoom the map in/out depending
I am trying to create some jquery styled hover fade in/out thumbnails. I've managed
I'm trying to create zoom in/out buttons on a canvas. The zooming works, however
I'm trying to make a level-of-detail line chart, where the user can zoom in/out
I am trying to figure out how to disable the default pinch to zoom
I'm trying to scale a container/parent movie clip up so that I effectively zoom
Im trying to figure out how to set the minimum someone can zoom out.
I was trying to add some buttons to some specific positions on an image.
i am trying to scale in and out a UIButton in the main view,
I am trying to implement multi touch zoom in and zoom out functionality to

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.