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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:43:35+00:00 2026-05-15T18:43:35+00:00

I am trying to create an app with horizontal scrolling, so that one would

  • 0

I am trying to create an app with horizontal scrolling, so that one would be able to scroll horizontally through a series of images. I watched the WWDC Session 104 video on this, and while they made an interesting app, they flew through the basics of it very quickly.

I understand using the UIScrollView, and that I have to enable paging. After that they say that I should add more views as subviews of the scrollview, but I am not clear on how to do that. I am also not clear on how I add my images to those views.

As you can probably tell I am pretty new at this so any help would be appreciated.

  • 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-15T18:43:36+00:00Added an answer on May 15, 2026 at 6:43 pm

    You want to look into UIImageView. It’s a view specifically for holding images.

    When you add your images, you want to set their rects (probably using initWithFrame: for each UIImageView) so that:

    • the first image is at 0,0
    • the second image is at 320,0
    • third is at 640,0 (etc)

    I.e. each image is 320 pixels right of the previous.

    The final step is to set the contentSize for your UIScrollView — this is a CGSize which describes the total size of the scroll view.

    If you have 3 images, you would then set it to (320*3) * 480 using e.g.

    myScrollView.contentSize = CGSizeMake(320*3, 480);
    

    A lot of people, when they initialize the scroll view, have a for loop or similar which steps through the images they want to display. These for loops tend to look something like this:

    CGFloat scrollWidth = 0.f;
    for (UIImage *someImage in someNSArrayWithImages) {
        UIImageView *theView = [[UIImageView alloc] initWithFrame:
            CGRectMake(scrollWidth, 0, 320.f, 480.f)];
        theView.image = someImage;
        [myScrollView addSubview:theView];
        [theView release];
        scrollWidth += 320.f;
    }
    myScrollView.contentSize = CGSizeMake(scrollWidth, 480.f);
    

    This way you’ll get things lined up and you’ll get the content size for you at the same time.

    If you want to make it so that the scroll view “intelligently” scrolls to each image and stops when people slide left/right, you can do myScrollView.pagingEnabled = YES.

    Hope that helps get you going.

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

Sidebar

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.