views:

228

answers:

1

Hi, I want to be able to swipe through a series of images in my iPhone app like in the Photos app. I want to have the pictures reside on the phone in the app itself.

I know the facebook three20 api does this but it reads the images from a url.

Does anyone know how I can implement this functionality?

A: 

For creating the 'swipe through' functionality, you'll have you use a UIScrollView with horizontal scrolling. The bounds of the UIScrollView should be set to the total available space, probably the whole screen (CGRectMake(0, 0, 320, 480)) and the contentSize should be the total width of the screens with images, so number of images * 320. The height of this contentSize should be set to the height of the UIScrollView itself, so only horizontal scrolling is possible.

For snapping to each image (so that would be every 320px) you can set the pagingEnabled property to YES (Thanks @Ben in the comments!)

Douwe Maan
To snap to each picture use the property on UIScrollView pagingEnabled = YES
Ben