Coder Social home page Coder Social logo

toursslivers / chipagecontrol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chililabs/chipagecontrol

0.0 0.0 0.0 2.42 MB

A set of cool animated page controls written in Swift to replace boring UIPageControl. Mady by @ChiliLabs - https://chililabs.io

License: MIT License

Ruby 3.27% Objective-C 2.46% Swift 94.27%

chipagecontrol's Introduction

CHIPageControl

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl. We were inspired by Jardson Almeida dribbble shot and implemented a few more page controls.

Made with ❤️ by Chili Labs.

Overview

Requirements

  • iOS 8.0+
  • Xcode 8+
  • Swift 3

Installation

Manually

Just add the CHIPageControl folder to your project.

CocoaPods

use CocoaPods with Podfile:

pod 'CHIPageControl', '~> 0.1.3'

# individual page control
pod 'CHIPageControl/Aji'
pod 'CHIPageControl/Aleppo'
pod 'CHIPageControl/Chimayo'
pod 'CHIPageControl/Fresno'
pod 'CHIPageControl/Jalapeno'
pod 'CHIPageControl/Jaloro'
pod 'CHIPageControl/Paprika'
pod 'CHIPageControl/Puya'

Carthage

use Carthage with Cartfile

github "ChiliLabs/CHIPageControl" ~> 0.1.3

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code.

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/ChiliLabs/CHIPageControl.git", .branch("master"))
]

And then build your project

$ swift build

Usage

🎨 Storyboards

Just drop UIView and set its class to be one of CHIPageControls.

💻 Code

let pageControl = CHIPageControlAji(frame: CGRect(x: 0, y:0, width: 100, height: 20))
pageControl.numberOfPages = 4
pageControl.radius = 4
pageControl.tintColor = .red
pageControl.currentPageTintColor = .green
pageControl.padding = 6

Adding multiple tintColors

// The size of the array needs to match the numberOfPages or it will throw an fatal error
pageControl.tintColors = [UIColor.black, UIColor.yellow, UIColor.black, UIColor.black]

// or

// If it is the first one, it will fill all colors with the selected tintColor and then replace the colors with the desired one
pageControl.insertTintColor(UIColor.yellow, position: 1)

Updating progress

//update dynamically
pageControl.progress = 0.5

//set progress with animation
pageControl.set(progress: 2, animated: true)

Touch events

You can hear touch events in any of the page indicators.

pageControl.enableTouchEvents = true

Delegate

Implement the CHIBasePageControlDelegate to catch touch events.

func didTouch(pager: CHIBasePageControl, index: Int)

Page Controls 🌶️🌶️🌶️

CHIPageControlAji

CHIPageControlAleppo

CHIPageControlChimayo

CHIPageControlFresno

CHIPageControlJalapeno

CHIPageControlJaloro

CHIPageControlPaprika

CHIPageControlPuya

License

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

chipagecontrol's People

Contributors

chili-ios avatar love4soul avatar mihailstumkins avatar serhanaksut avatar onurgenes avatar jstart avatar hoojy avatar fernandomatal avatar nunoonun avatar fpinvidio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.