Tuesday, April 5, 2011

How do you implement swipe-able image stacks like the Photo app using the iPhone SDK?

I would like to take a stack of images (or potentially an array of URLs to download images) and display them in full screen, one at a time, using user swipes to smoothly animate the next image in the stack, using the iPhone SDK. Apple's Photo.app seems to do this. Additionally, if the image has not been retrieved yet, I'd like to display the progress indicator.

Can you point me to example code and explain how this technique would be implemented?

From stackoverflow
  • You need to use UIScrollview's page control mechanism. Apple has plenty of sample code, including one called, strangely enough, Page Control:

    http://developer.apple.com/iphone/library/samplecode/PageControl/index.html

    If you want any behavior beyond that, you'll have to roll it yourself.

    Kevin Elliott : So do you believe UIScrollview page control is more efficient than making transitions occur between multiple UIImageView's?
    August : Not necessarily. But for a beginner, it's a much better start.
    Airsource Ltd : I used UIScrollView and paging to do this, with no performance problems. Obviously I only put three images in the scrollview at any one time.

0 comments:

Post a Comment