Home

Awesome

TKRubberIndicator

A rubber animation pagecontrol

Xcode 9.0+ iOS 8.0+ Swift 4.0+ Build Status CocoaPods Carthage compatible License MIT

Requirements

Installation

CocoaPods

You can use CocoaPods to install TKRubberPageControl by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'TKRubberPageControl'

To get the full benefits import TKRubberPageControl wherever you import UIKit

import UIKit
import TKRubberPageControl

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TKRubberPageControl.framework to an iOS project.

github "tbxark/TKRubberIndicator"

Manually

  1. Download and drop TKRubberPageControl.swift in your project.
  2. Congratulations!

Usage example

You can use closure or Target-Action to listen control event

class ViewController: UIViewController {

    let page = TKRubberIndicator(frame: CGRectMake(100, 100, 200, 100), count: 6)

    override func viewDidLoad() {
        super.viewDidLoad()


        self.view.backgroundColor = UIColor(red:0.553,  green:0.376,  blue:0.549, alpha:1)
        page.center = self.view.center
        page.valueChange = {(num) -> Void in
            print("Closure : Page is \(num)")
        }
        page.addTarget(self, action: "targetActionValueChange:", forControlEvents: UIControlEvents.ValueChanged)
        self.view.addSubview(page)

        page.numberOfpage = 2
    }

    @IBAction func pageCountChange(sender: UISegmentedControl) {
        page.numberOfpage = (sender.selectedSegmentIndex + 1) * 2
    }
    func targetActionValueChange(page:TKRubberIndicator){
        print("Target-Action : Page is \(page.currentIndex)")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

Base

KeyUsage
smallBubbleSize未选中小球尺寸unselect small ball size
mainBubbleSize选中大球尺寸select big ball size
bubbleXOffsetSpace小球间距The distance between the ball
bubbleYOffsetSpace纵向间距bubble Y Offset Space
animationDuration动画时长animation duration
backgroundColor背景颜色control background color
smallBubbleColor小球颜色unselect small ball color
mainBubbleColor大球颜色select big ball color

Release History

Contribute

We would love for you to contribute to TKRubberPageControl, check the LICENSE file for more info.

Meta

TBXark – @tbxarktbxark@outlook.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/TBXark