Scrolling Using Paging Mode
Configuring Paging Mode
1. Configuring a scroll view to support paging mode requires that code be implemented in the scroll view’s controller class.
2. Aside from the standard scroll view initialization described in “Creating and Configuring Scroll Views,” you must also set the pagingMode property to YES.
3. The contentSize property of a paging scroll view is set so that it fills the height of the screen and that the width is a multiple of the width of the device screen multiplied by the number of pages to be displayed.
4. Additionally, the scroll indicators should be disabled, because the relative location as the user is touching the screen is irrelevant, or is shown using a UIPageControl.
Configuring Subviews of a Paging Scroll View
2. When your application needs to display a large number of pages or drawing the page content can take some time, your application should use multiple views to display the content, one view for each page.
3. Supporting a large number of pages in a paging scroll view can be accomplished using only three view instances, each the size of the device screen: one view displays current page, another displays the previous page, and third displays the next page. The views are reused as the user scrolls through the pages.
4. The controller is responsible for keeping track of which page is the current page.
5. To determine when the pages need to be reconfigured because the user is scrolling the content, the scroll view requires a delegate that implements the scrollViewDidScroll: method. The implementation of this method should track
the contentOffset of the scroll view, and when it passes the mid point of the current view’s width, the views should be reconfigured, moving the view that is no longer visible on the screen to the position that represents the next or previous page. The delegate
should then inform the view that it should draw the content appropriate for the new location it the represents.
UIPageControl Class