UIScrollView with pagination + showing part of the previous/following pages

邮差的信 提交于 2019-11-29 19:52:57
lxcid

For your reference, you can see a sample implementation of a page control from here. https://developer.apple.com/library/content/samplecode/PageControl/Introduction/Intro.html

For the implementation you want, to your surprise, the scrollview's width is actually smaller than 320 (or 480). The magic property to set is:

scrollView.clipsToBounds = NO

The only problem with this implementation is that the scrollview get no touch events if the touch is outside the bounds of the scrollView. This can be fix by passing its parent hitTest event to scrollView.

Just to link to to a better explanation: UIScrollView horizontal paging like Mobile Safari tabs

Slightly different from what I recommend but does the same thing.

Edit:

I have a small project called LXPagingViews that does the above, hopefully in an out of the box manner (Do drop me a pull request or feedback in issue): https://github.com/lxcid/LXPagingViews

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!