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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:34:35+00:00 2026-05-30T11:34:35+00:00

I have a UIScrollView whose content size is 1200×480. I have some image views

  • 0

I have a UIScrollView whose content size is 1200×480. I have some image views on it, whose width adds up to 600. When scrolling towards the right, I simply increase the content size and set the offset so as to make everything smooth (I then want to add other images, but that’s not important right now). So basically, the images currently in the viewport remain somewhere on the left, eventually to be removed from the superview.

Now, the problem that I have happens when scrolling towards the left. What I do is I move the images to the end of the content size (so add 600 to each image view’s origin.x), and then set the content offset accordingly. It works when the finger is on the screen and the user drags (scrollView.isTracking = YES). When the user scrolls towards the left and lets go (scrollView.isTracking = NO), the image views end up moving too fast towards the right and disappear almost instantly. Does anyone know how I could have the images move nicely and not disappear even when the user’s not manually dragging the view and has already let go?

Here’s my code for dragging horizontally:

-(void) scrollViewDidScroll:(UIScrollView *)scrollView {
    CGPoint offset = self.scrollView.contentOffset;
    CGSize size = self.scrollView.contentSize;

    CGPoint newXY = CGPointMake(size.width-600, size.height-480);

    // this bit here allows scrolling towards the right
    if (offset.x > size.width - 320) {
        [self.scrollView setContentSize:CGSizeMake(size.width+320, size.height)];
        [self.scrollView setContentOffset: offset];
    }

    // and this is where my problem is:
    if (offset.x < 0) {
        for (UIImageView *imageView in self.scrollView.subviews) {
            CGRect frame = imageView.frame;
            [imageView setFrame:CGRectMake
                (frame.origin.x+newXY.x, frame.origin.y, 200, frame.size.height)];
        }
        [self.scrollView setContentOffset:CGPointMake(newXY.x+offset.x, offset.y)];
    } 
}

EDIT: This is now working – I had a look at StreetScroller and it’s all good now.

However, I now want to zoom in on the scrollview, but viewForZoomingInScrollView is never called. Is it not possible to zoom in on a scrollview with a large content size?

  • 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-30T11:34:36+00:00Added an answer on May 30, 2026 at 11:34 am

    There are some approaches floating around here. Just use the site search …

    If you want an more “official” example created by Apple take a look at the StreetScroller Demo. For some more information about this example take a look at last years WWDC session no. 104 Advanced Scroll View Techniques.

    There is also an UIScrollView subclass on Github called BAGPagingScrollView, which is paging & infinite, but it has a few bugs you have to fix on your own, because it’s not under active development (especially the goToPage: method leads to problems).

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

Sidebar

Related Questions

I have a UIScrollView that contains an image and a segmented control that allows
I have a UIScrollView in which I've set the contentSize to the size of
I have a UIScrollview with paging enabled. There are 3 views (pages) inside this
I have a uiscrollview and i am showing some dynamically generated uiimageview over it.
I have a UIScrollView which content is designed with Interface Builder. It has a
I have a UIScrollView with paging enabled. Each page is of width 768.0px in
I have a UIScrollView that can be scrolled horizontally. The scrollable content is displayed
I have an UIScrollView, that contains UIImageViews. All images keep their image ratio -
I have paging UIScrollView with images. I want to implement animated zooming of image
I have UIScrollView in my view. Problem is that if I slightly scroll it

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.