开发者

Scrolling horizontally between multiple images using UIScrollView

开发者 https://www.devze.com 2023-02-13 07:09 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号