Scrolling horizontally between multiple images using UIScrollView
If we start with the photos app for example. The images can be开发者_StackOverflow社区 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
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
精彩评论