NWPageScrollView is designed to simplify the implementation of horizontal, paged scrolling views on iOS. Take a look at the following example:
As we know, UIScrollView
has a property pagingEnabled
. It is a Boolean value that determines whether paging is enabled for the scroll view. If the value of this property is true, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is false.
NWPageScrollView is based on this trick.
Just add NWPageScrollView.swift
into your swift project.
- iOS 7.0+ / Mac OS X 10.10+
- Xcode 7.0
- Swift 2.0
The interface is UITableView-style. It's easy to use. Just open the demo project and run it.
Using like this:
topPageScrollView = NWPageScrollView()
topPageScrollView.pageScrollDelegate = self
topPageScrollView.initSetup(maxSize, cellSize: cellSize, padding: 0)
self.addSubview(topPageScrollView)
topPageScrollView.reloadData()
Do not forget to implement the NWPageScrollViewDelegate
MIT License, Please feel free to use it.