iphoneloopsautomationpaginationuiscrollview

Loop UIScrollView with added childviewcontrollers and automatically scroll?


I have 7 child viewcontrollers that I added to a parentview that has a uiscrollview (paging enabled) and a pagecontroller. How can I loop the 7th added child viewcontroller back to the first one when i swipe, and how do I automate this process to scroll through the pages in the loop every couple seconds?


Solution

  • Check out the answers on this page. UIScrollView Infinite Scrolling

    This may be especially helpful https://stackoverflow.com/a/5769904/1061125

    As for looping, you can just set an NSStimer to call a method. In this method, call the uiscrollviews scrollRectToVisible method, and pass it in a rect that is situated at the right hand side of your next view controller (for scrolling to the right).