This is accomplished using the UIScrollView with the pagingEnabled property set to true. Just add each of your views, adjust the contentSize, and it will automatically "page" to the width of the screen across the content.
views:
685answers:
4
+4
A:
NilObject
2009-02-18 21:35:13
Can you do this without show the UIScrollView and also have it provide the snap into place feel you get from the springrboard?
Niels Hansen
2009-02-18 21:39:38
Yes, set showsHorizontalScrollIndicator and showsVerticalScrollIndicator to false. Paging does exactly what you're mentioning for behavior
NilObject
2009-02-18 21:45:55
Very cool. I'll have to give this a try sometime!
unforgiven3
2009-04-06 23:10:08
A:
I'm writing an app that uses a similar UI. As NilObject recommended, we're using a UIScrollView
with pagingEnabled=YES
.
You may also be interested in this example code involving just two child views. I'm trying it out now; it's an interesting technique but I've had to write some additional special-casing code for some odd situations that resulted.
There's also another question on this site that asks about creating a grid of icons like the home screen.
PCheese
2009-02-19 07:19:49
A:
I would check out Joe Hewitt's code from the Three20 project for this. It provides a nice interface and further refinement of the UIScrollView implemented as TTScrollView and TTScrollViewDelegate, TTScrollViewDataSource.
Dave Shanley
2009-04-06 23:02:51