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

  • Home
  • SEARCH
  • 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 6724221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:39:47+00:00 2026-05-26T09:39:47+00:00

I setup up a ScrollView as root view for one of my view controllers.

  • 0

I setup up a ScrollView as root view for one of my view controllers. When I dragged the scroll view from the Interface builder, the scroll came up with an initial size of 220×120.

In that view controller viewDidLoad method, I have this code.

UIImage *iphone = [UIImage imageNamed:@"iphone4s.jpg"];
imageview = [[UIImageView alloc] initWithImage:iphone];
[self.view addSubview:imageview];


[(UIScrollView*)self.view setContentSize:[iphone size]];

the iphone image size is 600×800.

But the scroll view still is in size 220×120 when the view loads up on the screen. Should I do anything else to stretch the scrollView. Please help.

  • 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-26T09:39:48+00:00Added an answer on May 26, 2026 at 9:39 am

    The property contentSize is not the same as the size of the UIScrollView. Normally you’ll have a bigger content size in order to be able to scroll:

    +-------------------+
    |x------------+     |
    ||            |     | 
    ||            |     |
    |+------------+     |
    |                   |
    |                   |
    +-------------------+
    

    The inner rect in this sketch is the scroll view size (your 220×120), what you see in the screen, while the outer rect is the actual size of the object (600×800 in your case). Manipulating contentOffset point (the x in the figure) you can change which portion of the object is visible.

    If you don’t need the image to be scrollable, you don’t need a UIScrollView at all. Try with the UIImageView, change its frame and check the different values of its contentMode property.

    Also, don’t forget that views can auto adjust its size.

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

Sidebar

Related Questions

Setup: Tab Bar App First View is a ScrollView which has an ImageView as
Setup is following: Drupal project, one svn repo with trunk/qa/production-ready branches, vhosts for every
I'm attempting to setup a scrollview with infinite (horizontal) scrolling. Scrolling forward is easy
Within my Mac app I've setup two NSSplitViews to create a Mail-style interface (with
I would like to create a scrollview inside of another view. I put a
Ok, so I have this setup ScrollView HorizontalScrollView ImageView I am trying to capture
The documentation says: If the value of the property is YES, the scroll view
I'm just looking to setup a simple TextView wrapped in a ScrollView which will
I have a webview displayed in a scrollview and flip view and need to
I have a ScrollView which has two hidden images, one at the top and

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.