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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:04:30+00:00 2026-06-17T16:04:30+00:00

Before describing my problem a very basic question,is there a way can we return

  • 0

Before describing my problem a very basic question,is there a way can we return UIScrollView object from this method

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView

Now my problem is, I have a parent scrollview with multiple child scrollview inside it(all horizontal and paging enabled).

Each child scrollview has an ImageView. I am getting zoomScale factor from server and based on the image, I have to zoom it, The problem is when I try to zoom a child scrollView which has image inside it,it only zooms the last child scrollview.

So I think, I need to find out a way where we can return a scrollview form the above written delegate.

Anyone an idea how to solve this?


THis is UIView Class and i added scrollView and image on this and returned imageView For scrollView Delegate

SAMPLE CODE:

     - (id)initWithFrame:(CGRect)frame image:(UIImage *)image
{
    self = [super initWithFrame:frame];
    if (self) {

        self.backgroundColor=[UIColor yellowColor];      
        self.imageView = [[UIImageView alloc] initWithImage:image];
        self.imageView.tag = VIEW_FOR_ZOOM_TAG;
        self.imageView.frame=frame;//CGRectMake(8,8 ,305, 400);
        [self.imageView setContentMode:UIViewContentModeScaleAspectFit];


        self.scrollView = [[UIScrollView alloc] initWithFrame:frame];
        self.scrollView.minimumZoomScale = 0.4f;
        self.scrollView.maximumZoomScale = 2.0f;
        self.scrollView.backgroundColor=[UIColor redColor];
        self.scrollView.zoomScale = 1.0f;
        self.scrollView.contentSize = self.imageView.bounds.size;
        self.scrollView.delegate = self;
        self.scrollView.showsHorizontalScrollIndicator = NO;
        self.scrollView.showsVerticalScrollIndicator = NO;
        [self.scrollView setCanCancelContentTouches:NO];
        [self.scrollView addSubview:self.imageView];
        [self addSubview:self.scrollView];

        NSLog(@"ScrollViewPostion %f",self.scrollView.frame.origin.x);
    }
    return self;
}

#pragma -mark
#pragma -mark ScrollViewDelegates
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return [scrollView viewWithTag:VIEW_FOR_ZOOM_TAG];
}

And in my main viewController class i am doing this but its not adding all the images properly in the scrollview

 NSLog(@"Inner scrollFrame and content size %f %f",innerScrollFrame.origin.x,mainScrollView.contentSize.width);
    JoinSeeSubView *subView=[[JoinSeeSubView alloc] initWithFrame:innerScrollFrame image:img];
    [self.mainScrollView addSubview:subView];


        if (i < [self.allUrlArray count]-1) {
            innerScrollFrame.origin.x += innerScrollFrame.size.width;
    }
    i++;
    mainScrollView.contentSize = CGSizeMake(innerScrollFrame.origin.x + innerScrollFrame.size.width, mainScrollView.bounds.size.height);
  • 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-17T16:04:31+00:00Added an answer on June 17, 2026 at 4:04 pm

    In case the above approach didn’t help someone really in need,I solved this problem in a different way,but not sure if it is correct way to do this.

    So instead of creating a new class which extends UIView,I create and array and store all the objects of inner scrollview in that array.So my code look something like

           UIScrollView *pageScrollView = [[UIScrollView alloc] initWithFrame:innerScrollFrame];
            pageScrollView.minimumZoomScale = 0.4f;
            pageScrollView.maximumZoomScale = 2.0f;
            pageScrollView.zoomScale = 1.0f;
            pageScrollView.backgroundColor=[UIColor clearColor];
            pageScrollView.delegate = self;
            [pageScrollView addSubview:self.imageview];
            [mainScrollView addSubview:pageScrollView];
            [self.pageScrollViewObjArray addObject:pageScrollView];
    

    And whenever i need to access a particular imageview contained inside scrollview i do this :-

    UIScrollView *sv=(UIScrollView*)[self.pageScrollViewObjArray objectAtIndex:swipeCounter];
    sv.zoomScale=1.0f;
    

    But as i said earlier i don’t know how efficient this code is,but its been more than a month the app is on store and being tested properly ,yet no issue because of this.

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

Sidebar

Related Questions

Before describing the problem, let me first point out that this is a distinct
Ok, I asked this question before, but deleted it as the way I went
I know I've asked this question before, and I know there are plenty of
Yes, this question has been asked before, but I don't feel there's been a
before I start I want to point out that I tagged this question as
This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges
Before I get into describing by problem I'd like to point out I am
Question might be tricky (because of its nature or my way of describing it),
I have this function that makes an ajax call. I'm describing the problem in
Before asking the question let me preface with the fact that I am new

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.