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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:06:34+00:00 2026-05-28T00:06:34+00:00

I am going to add 5 buttons to scrollview ,in that scrollview when i

  • 0

I am going to add 5 buttons to scrollview ,in that scrollview when i am scrolling that scrollview has to scroll roundly, after end of fitth button again first button has to come to picture.

thanks..

  • 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-28T00:06:35+00:00Added an answer on May 28, 2026 at 12:06 am

    I have actually writen a blog post about this. Check out:

    http://blog.touch4apps.com/home/iphone-monotouch-development/monotouch-infinite-loop-image-scroll-view

    I found out that it can be possible to do with a simple tweak to UIScrollView, handing the

    scrollViewDidEndDecelerating from the UIScrollViewDelegate.

    Guys from Monotouch team made the great job on this (as usual) and we have the delegate already available via built-in events, in this case DecelerationEnded.

    So lets have a look at the implementation of the UIViewController class of some view, note we are adding the UI from the code, not from the nib file, just for simplicity. View has UIScrollView item and loads some images, last image is placed as the first one, then all images in the order and then first image as the last one.

    Then the event for DecelerationEnded is handled to actually swap the position (fast – no animation) so user does not find out. For added more touch, the paging is enabled and of course the scroller is hidden, so it is not visible to the user where in the scrolling position he actually is.

    public partial class ImageScrollViewController : UIViewController
    {
    #region Constructors

        // The IntPtr and initWithCoder constructors are required for items that need 
        // to be able to be created from a xib rather than from managed code
    
        public ImageScrollViewController (IntPtr handle) : base(handle)
        {
            Initialize ();
        }
    
        [Export("initWithCoder:")]
        public ImageScrollViewController (NSCoder coder) : base(coder)
        {
            Initialize ();
        }
    
        public ImageScrollViewController () : base("ImageScrollViewController", null)
        {
            Initialize ();
        }
    
        void Initialize ()
        {
        }
    
        #endregion
    
        UIScrollView scrollView;
    
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
    
            scrollView = new UIScrollView (new RectangleF (0, 0, 320, 480));
            this.View.AddSubview (scrollView);
    
            // add the last image (image4) into the first position
            this.AddImageWithName ("Images/image4.jpg", 0);
    
            // add all of the images to the scroll view
            for (int i = 1; i < 5; i++) {
                this.AddImageWithName (string.Format ("Images/image{0}.jpg", i), i);
            }
    
            // add the first image (image1) into the last position
            this.AddImageWithName ("Images/image1.jpg", 5);
    
            scrollView.PagingEnabled = true;
            scrollView.Bounces = true;
            scrollView.DelaysContentTouches = true;
            scrollView.ShowsHorizontalScrollIndicator = false;
    
            scrollView.ContentSize = new System.Drawing.SizeF (1920, 480);
            scrollView.ScrollRectToVisible (new RectangleF (320, 0, 320, 480), true);
            scrollView.DecelerationEnded += HandleDecelerationEnded;
    
        }
    
        void HandleDecelerationEnded (object sender, EventArgs e)
        {
            if (scrollView.ContentOffset.X == 0) 
            {         
                scrollView.ScrollRectToVisible(new RectangleF(1280, 0, 320, 480), false);
            }    
            else if (scrollView.ContentOffset.X == 1600) 
            {         
                scrollView.ScrollRectToVisible(new RectangleF(320, 0, 320, 480), false);
            }   
        }
    
        void AddImageWithName (string imageString, int position)
        {
            // add image to scroll view
            UIImage image = UIImage.FromFile (imageString);
            UIImageView imageView = new UIImageView (image);
    
            imageView.Frame = new System.Drawing.RectangleF (position * 320, 0, 320, 480);
    
            scrollView.AddSubview (imageView);
        }
    }
    

    That is actually all there is to it. And github link: http://github.com/sichy/ImageScrollView

    Happy coding!

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

Sidebar

Related Questions

I have an if else tree that is going to grow as I add
I have a universal iOS app with a custom view that has three buttons,
I have an existing Silverlight application where Page.xaml has some buttons on it that
Why should companies invest in refactoring components, though it is not going to add
( lol ) I have a panel on Form1. I'm going to add several
I am going to be coding up a windows service to add users to
I display a modal view controller and from there use buttons to add subviews.
I've got a marketing team that wants social sharing buttons (Facebook, G+, SU, and
I'm trying to create a view that's full of controls (buttons, text views, labels,
quick question - I have my first view which is going to be the

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.