Skip to content
πŸ’₯ Beautiful, animated and highly customizable UIPageControl alternative for iOS.
Swift Ruby
Branch: master
Clone or download
Latest commit ff5dbfd Dec 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
PageControl.xcodeproj update bundle id Dec 16, 2018
PageControl update demo Dec 14, 2018
PageControlTests add tests Dec 13, 2018
tutorial-resources update demonstration gif Dec 14, 2018
.gitignore update gitignore Dec 13, 2018
LICENSE added license file Oct 29, 2018
README.md update readme Dec 15, 2018
Sevruk-PageControl.podspec podcsepc updated Dec 14, 2018

README.md

PageControl

CocoaPods CocoaPods Swift 4.0

Requirements

  • iOS 9.0+
  • Xcode 7.0+

Installation

CocoaPods:

Add folowing line to Podfile and run 'pod instal'.

pod 'Sevruk-PageControl'

Or just drag and drop FoldingCell.swift file to your project

Usage with storyboard

  1. Add a new UIView to storyboard.

  2. Inherit view from PageControl.

1.1

  1. In view controller create an outlet to a view from storyboard and you're ready to go.

1.2

Here is code example that uses UIScrollView.

import UIKit
import PageControl

class ViewController: UIViewController, UIScrollViewDelegate {
    
    @IBOutlet weak var scrollView: UIScrollView!
    @IBOutlet weak var pageControl: PageControl!

    override func viewDidLoad() {
        super.viewDidLoad()
        scrollView.delegate = self
        pageControl.numberOfPages = Int(scrollView.contentSize.width / scrollView.bounds.width)
    }

    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        let page = scrollView.contentOffset.x / scrollView.bounds.width
        pageControl.currentPage = page
    }
}

Usage without storyboard

  1. Create a PageControl view and add it to your view hierarchy.
let pageControl = PageControl()
addSubview(pageControl)
  1. Setup pageControl with your needs.
pageControl.numberOfPages = 5
pageControl.spacing = 14.0
pageControl.indicatorDiameter = 8.0
pageControl.currentIndicatorDiameter = 12.0
pageControl.indicatorTintColor = .darkGray
pageControl.currentIndicatorTintColor = .green
  1. And update current page when needed.
pageControl.currentPage = 1

Contributing

I'd love for you to contribute in PageControl. Feel free to submit your pull requests.

Author

Feel free to contact me via linkedin Vova Sevruk or via email: vovaseuruk@gmail.com

Licence

PageControl is released under the MIT license. See LICENSE for details.

You can’t perform that action at this time.