views:

3510

answers:

4

Hey guys,

I need to use UIPagecontrol for my application, and I'm not sure how to get started. I'm a beginner, and the examples that apple gives me are pretty complicated. All I need are 3 pages with different views for each of them. Can anyone help me out here?

P.S. remember that I'm a beginner! :D

thanks

+3  A: 

You'll want to use a UIScrollView, and then, as a sibling, position the UIPageControl over it. Then put each of your pages into the scroll view and turn paging on for it. This way each 'flick' will move the scroll view one page over.

Now, assign your view controller to be the delegate of the scroll view, and watch for scrollViewDidEndScrollAnimation, and use the contentOffset to determine which page is current.

Ben Gottlieb
wow that seems kind of complicated. do you have a tutorial to do this or a sample code so i can see how it looks like?
Kevin
A: 

Better to search for the 320 library on

http://joehewitt.com/post/the-three20-project/ this will give fair idea of many uicontrols

Hope this helps.

Madhup
A: 

Here is a nice example from Cocoa With Love. It reuses only 2 actual views, for a nice low memory footprint.

Jane Sales
A: 

See my answer here: http://stackoverflow.com/questions/1103915/is-uipagecontrol-useless-by-itself/4014230#4014230

for a reusable class encapsulating the UIPageControl and UIScrollView.

Werner Altewischer