Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Logan Shire
2,539 PointsApp Store style scrolling in iOS
Hi guys. After looking at some of the articles about implementing cover flow, I've come to the conclusion that it would be more trouble than it is worth. Do you know how to implement the slide-rule style scrolling as seen in the app store on an iPhone when browsing screenshots? If someone knows or could point me in the right direction that would be awesome.
4 Answers
Marshall Huss
3,504 PointsThis can be done using a UIScrollView (docs) and setting the pagingEnabled to YES.
Just set the frames and add all your UIImageViews as a subviews. Then set the contrentSize equal to the total width of the images and any padding. Paging will automatically make it snap when swiping.
Let me know if you'd like to see some example code.
Logan Shire
2,539 PointsWow that's awesome! Some example code would be great if you have the time!
Marshall Huss
3,504 PointsHere's a quick snippet of code (untested), but should help you get the idea. If you want it to work like the App Store does then you'll need to change the width of the scroll view and account for some padding in between the image views.
Peter Pult
8,095 PointsWe needed that function some months ago and this post really helped us.