A simple infinite page scroll view, writen in Swift 3.0
Clone this git and run the demo, you'll see how to use InfinitPageView!
-
confirm your class to protocol UIInfinitePageViewDelegate
// returns the number of pages you have func numberOfViews() -> Int { return 3 } // returns every page in your infinite page view func InfinitePageView(viewForIndexAt index: Int) -> UIView { let label = UILabel() label.textAlignment = .center label.text = "Notice: This is vertical page \(index)" return label }
-
create an InfinitePageView instance, and customize some features
let customVerticalView = UIInfinitePageView() customVerticalView.delegate = self customVerticalView.scrollDirection = .vertical customVerticalView.duringTime = 3.0
-
add this view to your wrapper view's subviews, and set the frame or the constaints of it
self.view.addSubview(customVerticalView) customVerticalView.snp.makeConstraints { (make) in make.center.equalToSuperview() make.height.equalTo(32) make.width.equalTo(320) }
-
reload data to inform InfinitePageView that you are ready to show the view
customVerticalView.reloadData()
// TODO