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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:52:09+00:00 2026-05-20T10:52:09+00:00

Ok, I have been working on solving this problem all day, and I am

  • 0

Ok, I have been working on solving this problem all day, and I am getting really close. I am trying to have create a way to view more than one scrollView/imageView nested pair that allows for zooming on an image.

When the view loads, there is just one scrollView that takes up the whole screen, but then when a button is pressed, I cut the width of the first scrollView in half, and unhide another (which has a nested imageView in it as well) right next to it. So there is a split view effect, and ideally the user will be able to pinch and zoom each image separately.

So I have all that working except for the separate pinch and zoom part. No matter where I pinch on the screen, only the first scrollView zooms. So even though I am touching another scrollView, it is still only affecting the first.

I have them setup in IB, and then they are setup in viewDidLoad this way:

[scrollView setBackgroundColor:[UIColor blackColor]];
[scrollView setCanCancelContentTouches:NO];
scrollView.clipsToBounds = YES;    // default is NO, we want to restrict drawing within our scrollview
scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;

scrollView.minimumZoomScale = 1;
scrollView.maximumZoomScale = 5;
scrollView.delegate = self;
[scrollView setScrollEnabled:YES];

imageView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"monitor.JPG"]];

[scrollView addSubview:imageView3];
//[scrollView setFrame:CGRectMake(0, 0, 1024, 660)];


[scrollView1 setBackgroundColor:[UIColor blackColor]];
[scrollView1 setCanCancelContentTouches:NO];
scrollView1.clipsToBounds = YES;    // default is NO, we want to restrict drawing within our scrollview
scrollView1.indicatorStyle = UIScrollViewIndicatorStyleWhite;

scrollView1.minimumZoomScale = 1;
scrollView1.maximumZoomScale = 5;
scrollView1.delegate = self;
[scrollView1 setScrollEnabled:YES];

imageView31 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"monitor.JPG"]];

[scrollView1 addSubview:imageView31];

And then I hide and unhide different scrollViews (I have 40 depending on the segmentedControl index on the toolbar. Am I headed in the right direction? Is it possible to have two separately accessible scrollViews?

Any help would be appreciated.

Thanks!

EDIT:

Ok so I went through and updated the clipToBunds bit…DUH. It definitely makes it look better, but still isn’t solving the problem. Here is the code I am calling depending on the selected index:

-(void) pickedOne{


if(segment.selectedSegmentIndex == 0){

    [scrollView setFrame:CGRectMake(0, 0, 1024, 660)];
    [scrollView setContentSize:CGSizeMake(1024, 660)];
    scrollView.hidden = NO;

    scrollView1.hidden = YES;
    scrollView2.hidden = YES;
    scrollView3.hidden = YES;

}else if(segment.selectedSegmentIndex == 1){

    [scrollView setFrame:CGRectMake(0, 0, 512, 660)];
    scrollView.zoomScale = 1.0;
    scrollView.hidden = NO;


    [scrollView1 setFrame:CGRectMake(512, 0, 512, 660)];
    scrollView1.zoomScale = 1.0;
    scrollView1.hidden = NO;

            scrollView2.hidden = YES;
            scrollView3.hidden = YES;

}

Is there anything majorly wrong with that approach?

If I pinch to zoom on the right scrollView, it makes the scroll view bigger, (but doesn’t increase the size of the scrollView2 image) but it DOES increase the size of the first scrollView’s image when you pinch inside of EITHER scrollViews…strange

  • 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-20T10:52:09+00:00Added an answer on May 20, 2026 at 10:52 am
    scrollView.clipsToBounds = NO;    // default is NO, we want to restrict drawing within our scrollview
    

    Isn’t this the opposite of what you want? Setting it to YES restricts restricts drawing to within your scrollview.

    It sounds to me like you aren’t resizing the scrollview. Are you resizing its contents or the image view within it? Can you post the code that is called when you tap the button?

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

Sidebar

Related Questions

I have been learning Scala for the past couple of months and now I
All of these questions: Excel 2007 Hangs When Closing via .NET How to properly
After switching to AS3, I've been having a hell of a time figuring out
I'm working on an IRC client. I've hit a majors snag which, up until
I'm working on an ASP.NET WebForms CMS application, and having a bit of trouble
I am working on an application and one design approach involves extremely heavy use
I'm a brand-newbie to C#, albeit not programming, so please forgive me if I
Here is my sample code. It is meant to be an iterative procedure for
I work in the technical group at a large Architecture firm. While there are
I run a rather complex project with several independent applications. These use however 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.