Popularity
2.4
Growing
Activity
0.0
Stable
109
2
11

Code Quality Rank: L5
Programming language: Swift
Tags: UI    
Latest version: v2.1.0

PageControl alternatives and similar libraries

Based on the "UI" category

Do you think we are missing an alternative of PageControl or a related project?

Add another 'UI' Library

README

Page Control

Installation

Carthage compatible GitHub release Swift

Usage Example

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)
        pageControl.addTarget(self, action: #selector(pageControlDidChangeCurrentPage(_:)), for: .valueChanged)
    }

    func pageControlDidChangeCurrentPage(_ pageControl: PageControl) {
        scrollView.setContentOffset(CGPoint(x: scrollView.bounds.width * CGFloat(pageControl.currentPage), y: 0), animated: true)
    }

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        if scrollView.isDragging || scrollView.isDecelerating {
            let page = scrollView.contentOffset.x / scrollView.bounds.width
            pageControl.setCurrentPage(page)
        }
    }
}

License


*Note that all licence references and agreements mentioned in the PageControl README section above are relevant to that project's source code only.