A flexible UIPageControl like Instagram.
For Installing with Carthage, add it to your Cartfile.
github "shima11/FlexiblePageControl"
$ carthage update
For installing with CocoaPods, add it to your Podfile.
pod "FlexiblePageControl", :git => "https://github.com/shima11/FlexiblePageControl.git"
$ pod update
let pageControl = FlexiblePageControl()
pageControl.numberOfPages = 10
view.addSubview(pageControl)
// Updated to the minimum size according to the displayCount
pageControl.updateViewSize()
pageControl.dotSize = 8
pageControl.dotSpace = 5
pageControl.displayCount = 8
pageControl.pageIndicatorTintColor = UIColor.gray
pageControl.currentPageIndicatorTintColor = UIColor.blue
func scrollViewDidScroll(_ scrollView: UIScrollView) {
pageControl.setProgress(contentOffsetX: scrollView.contentOffset.x, pageWidth: scrollView.bounds.width)
}
or
pageControl.currentPage = page
Licence MIT