How to implement zooming *and* paging like iOS Pho

2019-04-14 12:09发布

In Apple's photo's app you can swipe between photos while viewing, and also zoom into and pan around a photo. When you get to the edge of a zoomed photo you can still swipe into the next image - what kind of scrollview setup is needed to allow this?

2条回答
对你真心纯属浪费
2楼-- · 2019-04-14 12:47

The easiest way to do this is to create one scroll view that scrolls only horizontally and has pagingEnabled set to YES. Each page of this scroll view then contains another zoomable scroll view for an individual photo.

查看更多
你好瞎i
3楼-- · 2019-04-14 12:53

There's an excellent video from WWDC 2010 - https://developer.apple.com/videos/wwdc/2010/

The session is titled "Designing Apps with Scroll Views". It's a step-by-step of exactly what you're asking.

Per omz's response, the paging scroller part is pretty straight forward. But Apple does some more complex things with how the zoomable scroll views are created and reused. You really should check out the video.

查看更多
登录 后发表回答