● ○ ○ ○ A nice, animated UIPageControl alternative.

Overview

Page Control

Installation

Swift Package Manager compatible 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)
    }

    @objc 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

You might also like...
Nicely animated flat design switch alternative to UISwitch
Nicely animated flat design switch alternative to UISwitch

AIFlatSwitch A smooth, nice looking and IBDesignable flat design switch for iOS. Can be used instead of UISwitch. Inspired by Creativedash's Dribbble

FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax.
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax.

FlexLayout adds a nice Swift interface to the highly optimized Yoga flexbox implementation. Concise, intuitive & chainable syntax. Flexbox is an incre

A UIActivityViewController to share images while displaying them as a nice preview.
A UIActivityViewController to share images while displaying them as a nice preview.

PSActivityImageViewController Overview This view controller allows you to share an image the same way as a normal UIActivityViewController would, with

Simple Swift class for iOS that shows nice popup windows with animation.
Simple Swift class for iOS that shows nice popup windows with animation.

NMPopUpView Simple class for iOS that shows nice popup windows, written in Swift. The project is build with Swift 4.0, so you need Xcode 9.0 or higher

Elegant library that wraps working with frames with a nice chaining syntax.
Elegant library that wraps working with frames with a nice chaining syntax.

Everyone wants to see smooth scrolling, that tableview or collectionview scrolls without any lags and it's right choice. But the constraints do not gi

A drop-in universal library allows to record audio within the app with a nice User Interface.
A drop-in universal library allows to record audio within the app with a nice User Interface.

IQAudioRecorderController IQAudioRecorderController is a drop-in universal library allows to record and crop audio within the app with a nice User Int

Nice category that adds the ability to set the retry interval, retry count and progressiveness.
Nice category that adds the ability to set the retry interval, retry count and progressiveness.

If a request timed out, you usually have to call that request again by yourself. AFNetworking+RetryPolicy is an objective-c category that adds the abi

NiceAlertView is a Swift framework that can increase time of development and show nice custom AlertsViews
NiceAlertView is a Swift framework that can increase time of development and show nice custom AlertsViews

NiceAlertView Nice and beautiful AlertView for your iOS project NiceAlertView is a Swift framework that can increase time of development and show nice

An App that gives a nice interface where the user can type in their start location and destination

SixtCarSummoner What it does We developed an App that gives a nice interface where the user can type in their start location and destination. The user

A nice iOS View Capture Swift Library which can capture all content.
A nice iOS View Capture Swift Library which can capture all content.

SwViewCapture A nice iOS View Capture Library which can capture all content. SwViewCapture could convert all content of UIWebView to a UIImage. 一个用起来还

Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project

HGPlaceholders Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Xcode 9

Awesome TextField is a nice and simple libriary for iOS and Mac OSX
Awesome TextField is a nice and simple libriary for iOS and Mac OSX

Awesome TextField is a nice and simple libriary for iOS and Mac OSX. It's highly customisable and easy-to-use tool. Works perfectly for any registration or login forms in your app.

Lightweight set of text fields with nice animation and functionality
Lightweight set of text fields with nice animation and functionality

TweeTextField This is lightweight library that provides different types of Text Fields based on your needs. I was inspired by Jan Henneberg. Features

A nice tutorial like the one introduced in the Path 3.X App
A nice tutorial like the one introduced in the Path 3.X App

ICETutorial Welcome to ICETutorial. This small project is an implementation of the newly tutorial introduced by the Path 3.X app. Very simple and effi

Splito - Nice and easy-to-use billing and tip calculator with swift
Splito - Nice and easy-to-use billing and tip calculator with swift

Splito! Nice and easy-to-use billing and tip calculator

Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)
Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)

Schedule(简体中文) Schedule is a timing tasks scheduler written in Swift. It allows you run timing tasks with elegant and intuitive syntax. Features Elega

MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.
MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.

MZFormSheetPresentationController MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding sup

🔄 GravitySlider is a beautiful alternative to the standard UICollectionView flow layout.
🔄 GravitySlider is a beautiful alternative to the standard UICollectionView flow layout.

GravitySliderFlowLayout Made by Applikey Solutions Find this project on Dribbble Table of Contents Purpose Supported OS & SDK Versions Installation Us

A modern AppList alternative

AltList A modern AppList alternative The main focus of this dependency is to be an easy to use and easy to customize framework to handle per app prefe

Comments
  • PageControl disappears on adding or removing new pages

    PageControl disappears on adding or removing new pages

    Thanks for sharing the control. I ran into an issue when using it in combination with UIPageViewController. When I update the number of UIViewControllers which are contained in the UIPageViewController the PageControl disappears.

    I recorded this gif (https://abload.de/img/nov-03-201618-31-58a9jcm.gif) to demonstrate the issue. At first there are two UIViewController, which can be swipped through. With a click on the "+" button a new UIViewController gets added to the datasource of UIPageViewController - this makes the PageControl disappear.

    For updating numberOfPages I wrote the following function

    func mainPageViewController(mainPageViewController: MainPageViewController, didUpdatePageCount count: Int) { pageControl.numberOfPages = count }

    Do you have an idea why this happens? THX

    opened by nor0x 0
Owner
Kasper Lahti
Kasper Lahti
CHIPageControl is a set of cool animated page controls to replace boring UIPageControl.

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl. We were inspired by Jardson Almeida dribbble sh

Chili Labs 3.1k Jan 4, 2023
FlexiblePageControl - A flexible UIPageControl like Instagram.

FlexiblePageControl A flexible UIPageControl like Instagram. OverView Install Carthage For Installing with Carthage, add it to your Cartfile. github "

shima 732 Dec 26, 2022
This is a selection of custom page controls to replace UIPageControl

PageControls This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here. The appearance (color, size, # o

Kyle Zaragoza 1k Jan 2, 2023
This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl

NSPageControl This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl. Demo ##Installation NSPageControl supports multiple

Kohei Tabata 13 Jan 19, 2022
💥 Beautiful, animated and highly customizable UIPageControl alternative for iOS.

PageControl Requirements iOS 9.0+ Xcode 7.0+ Installation CocoaPods: Add folowing line to Podfile and run 'pod instal'. pod 'Sevruk-PageControl' Or j

Sevruk Development 30 May 2, 2022
Animated Mask Label is a nice gradient animated label.

Animated Mask Label Demo Screen Screenshot Demo/Example For demo: $ pod try AnimatedMaskLabel To run the example project, clone the repo, and run pod

Jogendra 19 Dec 13, 2022
CHIPageControl is a set of cool animated page controls to replace boring UIPageControl.

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl. We were inspired by Jardson Almeida dribbble sh

Chili Labs 3.1k Jan 4, 2023
FlexiblePageControl - A flexible UIPageControl like Instagram.

FlexiblePageControl A flexible UIPageControl like Instagram. OverView Install Carthage For Installing with Carthage, add it to your Cartfile. github "

shima 732 Dec 26, 2022
This is a selection of custom page controls to replace UIPageControl

PageControls This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here. The appearance (color, size, # o

Kyle Zaragoza 1k Jan 2, 2023
This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl

NSPageControl This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl. Demo ##Installation NSPageControl supports multiple

Kohei Tabata 13 Jan 19, 2022