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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:49:45+00:00 2026-06-17T12:49:45+00:00

I would like to have a view controller that loops an image in the

  • 0

I would like to have a view controller that loops an image in the background to give the appearance of infinite scrolling. For example, If I were to use the image below, the left and right edges match up perfectly, and would be used to give an infinite scrolling appearance. Does anyone know how I might go about setting this up? I have done some research and am lost. Thank you all!

Infinite Scrolling Image

  • 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-17T12:49:46+00:00Added an answer on June 17, 2026 at 12:49 pm

    I’d do it this way. EDIT Rather than leave it as an exercise for the reader, updated to show how to pan in either direction…

    @property (nonatomic, assign) BOOL keepGoing;
    @property (nonatomic, assign) BOOL panRight;
    @property (nonatomic, strong) UIImageView *imageViewA;
    @property (nonatomic, strong) UIImageView *imageViewB;
    
    - (void)getReady {
    
        // init theImage
        UIImage *theImage = [UIImage imageNamed:@"theImage.png"];
    
        // get two copies of the image
        self.imageViewA = [[UIImageView alloc] initWithImage:theImage];
        self.imageViewB = [[UIImageView alloc] initWithImage:theImage];
    
        // place one in view, the other, off to the right (for right to left motion)
        NSInteger direction = (self.panRight)? 1 : -1;
        self.imageViewA.frame = self.view.bounds;
        self.imageViewB.frame = CGRectOffset(self.view.bounds, direction*self.imageViewA.bounds.size.width, 0.0);
    
        [self.view addSubview:self.imageViewA];
        [self.view addSubview:self.imageViewB];
        self.keepGoing = YES;
    }
    
    - (void)go {
        NSInteger direction = (self.panRight)? 1 : -1;
        CGFloat offsetX = -direction*self.imageViewA.bounds.size.width;
    
        [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
            self.imageViewA.frame = CGRectOffset(self.imageViewA.frame, offsetX, 0);
            self.imageViewB.frame = CGRectOffset(self.imageViewB.frame, offsetX, 0);
        } completion:^(BOOL finished) {
            if (self.keepGoing) {
                // now B is where A began, so swap them and reposition B
                UIImageView *temp = self.imageViewA;
                self.imageViewA  = self.imageViewB;
                self.imageViewB = temp;
                self.imageViewB.frame = CGRectOffset(self.view.bounds, direction*self.view.bounds.size.width, 0.0);
                // recursive call, but we don't want to wind up the stack
                [self performSelector:@selector(go) withObject:nil afterDelay:0.0];
            }
        }];
    }
    

    To make it go, set the panRight property, then call [self getReady]; and [self go];.

    It will run mostly asynch. To make it stop, set self.keepGoing = NO;.

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

Sidebar

Related Questions

Let's say I have a PHP Model-View-Controller framework that maps an address like http://example.com/admin/posts/edit/5
I would like to have a custom view in my application that consists of
I have a view that I would like to populate data when the next
I have a custom View that I would like to embed in an WebView.
I have a video view that is full screen and would like to trigger
I have a view that looks like this: http://whatever/Download/viaId/12345 And i would like to
I have a simple Partial View that I would like to automatically call a
I have a ViewController that has its own NIB. I would like to embed
For example I have a ViewController named firstViewController. Then I would like to call
I have a view which I would like to fill up the entire screen

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.