Using UIScrollView with UIPageControl


#1

I have the Paging challenge working using UIScrollView and UITabBarController, with the same resizing problem mentioned in an earlier post. I’m curious, though…how would one go about using UIScrollView with UIPageControl? I’m having difficulty interpreting the dot syntax in Apple’s PageControl example. Hints?


#2

The page control is just a visual indicator. If you want to use one, you will have to have a view hierarchy that is a plain UIView with two subviews, a UIScrollView and a UIPageControl. The page control will be a sibling view of the scroll view and also be added to its superview after the scroll view (so it appears above the scroll view).

When you use a page control, you need to set the number of pages it is (this is the number of dots it has).

[pageControl setNumberOfPages:10];

Then as you change the current page, you set the currentPage.

[pageControl setCurrentPage:2];