Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling horizontally between multiple images using UIScrollView

If we start with the photos app for example. The images can be viewed with a swipe and the images scroll into view as the user swipes.

How is this kind of UIScrollView setup and how are the Images (e.g. from an array) displayed within this UISCrollView?

Are the images added to the scrollview at once or how is this paging look achieved?

Thanks

like image 703
some_id Avatar asked Feb 22 '11 23:02

some_id


1 Answers

This can be achieved using a main UIScrollView with pagingEnabled set to YES and containing nested UIScrollViews. Then you can put an UIImageView in each one of these nested scroll views, so you can also achieve zooming by returning it to - (UIView *)viewForZoomingInScrollView:

Also, you can take a look at these samples from Apple:

http://developer.apple.com/library/ios/#samplecode/Scrolling/Introduction/Intro.html

http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/Introduction/Intro.html

like image 77
ySgPjx Avatar answered Oct 12 '22 17:10

ySgPjx