51
GitHub - shima11/FlexiblePageControl: A flexible UIPageControl like Instagram.
source link: https://github.com/shima11/FlexiblePageControl
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
FlexiblePageControl
A flexible UIPageControl like Instagram.
OverView
Install
Carthage
For Installing with Carthage, add it to your Cartfile
.
github "shima11/FlexiblePageControl"
$ carthage update
CocoaPods
For installing with CocoaPods, add it to your Podfile
.
pod "FlexiblePageControl"
$ pod update
Usage
let pageControl = FlexiblePageControl()
pageControl.numberOfPages = 10
view.addSubview(pageControl)
Customize
// color
pageControl.pageIndicatorTintColor = color1
pageControl.currentPageIndicatorTintColor = color2
// size
let config = Config(
displayCount: 7,
dotSize: 6,
dotSpace: 4,
smallDotSizeRatio: 0.5,
mediumDotSizeRatio: 0.7
)
pageControl.setConfig(config)
Update page
func scrollViewDidScroll(_ scrollView: UIScrollView) {
pageControl.setProgress(contentOffsetX: scrollView.contentOffset.x, pageWidth: scrollView.bounds.width)
}
or
pageControl.setCurrentPage(at: page)
Licence
Licence MIT
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK