Skip to content

indevizible/CharPageControl

Repository files navigation

CharPageControl

Cocoapods Compatible Carthage Compatible ![GitHub license](https://img.shields.io/badge/license-Apache 2.0-lightgrey.svg) Platform Twitter

CharPageControl is a GLYPH style for pagination written in swift.

Demo

Features

  • Custom font
  • Color transition
  • IBInspectable support

inspecable

  • IBDesignable support (Error on swift 3)

inspecable

Requirements

  • Swift 2+
  • Swift 3
  • iOS 8.0+

Installation

You can install this library in 2 ways

Manually

Copy CharPageControl.swift to your project.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate CharPageControl into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'CharPageControl', '~> 2.0'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate CharPageControl into your Xcode project using Carthage, specify it in your Cartfile:

github "indevizible/CharPageControl" ~> 2.0

Run carthage update to build the framework and drag the built CharPageControl.framework into your Xcode project.

Usage

  • Import and declare CharPageControl:
import CharPageControl

class ViewController: UIViewController{
  @IBOutlet
  var pageControl: CharPageControl!
}
  • Drag and drop UILabel from panel to storyboard
  • Change UILabel class to CharPageControl
  • Go to Attribute Inspector and set your pattern and other properties
  • Embed label to your ViewController class
  • And set page with CGFloat when scrollView did scroll
func scrollViewDidScroll(scrollView: UIScrollView) {
  let currentPage = (CGFloat(pageCount) * scrollView.contentOffset.x)/scrollView.contentSize.width
  pageControl.currentPage = currentPage
}

And more on CharPageControlExample.xcodeproj

Credit

This project was Inspired by Virakri Jinangkul

Author

Nattawut Singhchai, [email protected]

License

CharPageControl is available under the Apache 2.0 license. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published