FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
Features
Infinite scrolling.
Automatic Sliding.
Horizontal and Vertical paging.
Fully customizable item, with predefined banner-style item.
The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0.
e.g.
pagerView.automaticSlidingInterval = 3.0
isInfinite
A boolean value indicates whether the pager view has infinite number of items. Default is false.
e.g.
pagerView.isInfinite = true
decelerationDistance
An unsigned integer value that determines the paging distance of the pager view, which indicates the number of passing items during the deceleration. When the value of this property is FSPagerView.automaticDistance, the actual ‘distance’ is automatically calculated according to the scrolling speed of the pager view. Default is 1.
e.g.
pagerView.decelerationDistance = 2
itemSize
The item size of the pager view. When the value of this property is FSPagerView.automaticSize, the items fill the entire visible area of the pager view. Default is FSPagerView.automaticSize.
// Create a pager view
let pagerView = FSPagerView(frame: frame1)
pagerView.dataSource = self
pagerView.delegate = self
pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell")
self.view.addSubview(pagerView)
// Create a page control
let pageControl = FSPageControl(frame: frame2)
self.view.addSubview(pageControl)
Getting started with Interface Builder
1、Simply drag UIView instance into your View Controller, Change the Custom Class to FSPagerView. (Or FSPageControl)
2、Link the dataSource and delegate property of FSPagerView to your View Controller.
3、Register a cell class.
FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
Features
Demos
Demo1 - Banner
automaticSlidingInterval
The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0.
e.g.
isInfinite
A boolean value indicates whether the pager view has infinite number of items. Default is false.
e.g.
decelerationDistance
An unsigned integer value that determines the paging distance of the pager view, which indicates the number of passing items during the deceleration. When the value of this property is FSPagerView.automaticDistance, the actual ‘distance’ is automatically calculated according to the scrolling speed of the pager view. Default is 1.
e.g.
itemSize
The item size of the pager view. When the value of this property is FSPagerView.automaticSize, the items fill the entire visible area of the pager view. Default is FSPagerView.automaticSize.
e.g.
interitemSpacing
The spacing to use between items in the pager view. Default is 0.
e.g.
Demo2 - Transformers
Demo3 Page Control
numberOfPages
The number of page indicators of the page control. Default is 0.
e.g.
currentPage
The current page, highlighted by the page control. Default is 0.
e.g.
contentHorizontalAlignment
The horizontal alignment of content within the control’s bounds. Default is center.
e.g.
setStrokeColor:forState:
Sets the stroke color for page indicators to use for the specified state. (selected/normal).
e.g.
setFillColor:forState:
Sets the fill color for page indicators to use for the specified state. (selected/normal).
e.g.
setImage:forState:
Sets the image for page indicators to use for the specified state. (selected/normal).
e.g.
setPath:forState:
Sets the path for page indicators to use for the specified state. (selected/normal).
e.g.
Installation
Manually
Cocoapods
Carthage
Tutorial
1. Getting started
1、Simply drag UIView instance into your View Controller, Change the
Custom Class
toFSPagerView
. (OrFSPageControl
)2、Link the
dataSource
anddelegate
property of FSPagerView to your View Controller.3、Register a cell class.
2. Implement FSPagerViewDataSource
3. Implement FSPagerViewDelegate
Support this repo
Star this repo
Buy me a Coffee. ☕️
Author
Documentation