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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:19:52+00:00 2026-05-28T05:19:52+00:00

So I have a UIImageView as a subview of UIScrollView , I’ve set the

  • 0

So I have a UIImageView as a subview of UIScrollView, I’ve set the contentSize to be smaller than the UIImageView width and height, however it doesn’t allow me to scroll.. why is this? Here’s some code:

UIImage * image = [UIImage imageWithData:data];
                UIImageView * imgView = [[UIImageView alloc] initWithImage:image];
                [imgView setUserInteractionEnabled:YES];
                //[imgView setContentMode:UIViewContentModeScaleAspectFill];
                [imgView setBackgroundColor:[UIColor clearColor]];
                [imgView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
                [imgView setFrame:CGRectMake(0, 0, imgView.frame.size.width, imgView.frame.size.height)];

                CGRect imgFrame;
                imgFrame.size.width = originalImageSize.width;
                imgFrame.size.height = originalImageSize.height;
                imgFrame.origin.x = imageOriginPoint.x;
                imgFrame.origin.y = imageOriginPoint.y;

                UIScrollView * imgScrollView = [[UIScrollView alloc] initWithFrame:imgFrame];
                [imgScrollView setScrollEnabled:YES];
                [imgScrollView setClipsToBounds:YES];
                [imgScrollView addSubview:imgView];
                [imgScrollView setBackgroundColor:[UIColor clearColor]];


  [imgScrollView setFrame:imgFrame];
                [imgScrollView setContentSize:CGSizeMake(200, 200)];

SCROLL VIEW CONTENT SIZE WIDTH IS 200.000000 AND HEIGHT CONTENT SIZE IS 200.000000
UIIMAGE VIEW WIDTH IS 2240.225830 AND HEIGHT IS 2240.225830
SCROLL VIEW FRAME WIDTH IS 768.000000 AND SCROLL VIEW FRAME HEIGHT IS 768.000061

Any idea?

  • 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-28T05:19:52+00:00Added an answer on May 28, 2026 at 5:19 am

    That’s because that your size of bounds of scroll view is larger than your content size.
    The content size need to be the actual size of image view, and the visible size is set by frame / bounds. I guess you want to scroll a image in a {200, 200} sized rect?
    Try this:

            UIScrollView * imgScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; // this is your visible rect
            [imgScrollView setScrollEnabled:YES];
            [imgScrollView setClipsToBounds:YES];
            [imgScrollView addSubview:imgView];
            [imgScrollView setBackgroundColor:[UIColor yellowColor]];
    
            [imgScrollView setContentSize:imgFrame.size]; // this is your image view size
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIScrollView with a UIImageView subview created in IB. The first time
I have a UIImageView element as a subview of my main UIScrollView element. I
I have a UIImageView showing a image that is larger than it's frame. It's
i have a UIView UIImageview UIButton and UISlider added as subview to UIView example:
I have one view controller in which I have added UIScrollView & UIImageView programatically.
I have a Custom Scroll View, subclassing UIScrollView . I have added a scroll
I have a UIImageView as a subview of UIView (frame size 300 x 300
I have a UIScrollView on it I have UIImageView 's and UIButton , when
I have a UIView that has a UIScrollView as a subview, which in turn
I have a UIScrollView and inside it there is a UIImageView with an image.

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.