Giter VIP home page Giter VIP logo

tkrubberindicator's Introduction

TKRubberIndicator

A rubber animation pagecontrol

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

Requirements

  • Swift 4.0
  • iOS 8.0+
  • Xcode 9.0

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

Key Usage
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

  • 1.4.0 Swift 4.0

  • 1.3.1 Bug Fixed

  • 1.3.0 Support Swift 3.0

  • 1.0.5 Fix bug, add Cocoapod and Carthage support

  • 1.0.4 Complete basic functions

Contribute

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

Meta

TBXark – @tbxark[email protected]

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

https://github.com/TBXark

tkrubberindicator's People

Contributors

tbxark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tkrubberindicator's Issues

currentIndex doesnt change

When setting the current index programmatically, the current index is not reflected in the UI. There is no animation change or anything.

Line 218

if index == currentIndex { return }

is always true

Swift 3 compatibility

Hey, I'd love to see this lib available in Swift 3 so I can implement it in my project.

Thanks 😄

Carthage failed importing

▶ carthage update
*** Please update to the latest Carthage version: 0.24.0. You currently are on 0.22.0
*** Cloning TKRubberPageControl
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/tbxark/TKRubberPageControl.git /Users/Fooar/Library/Caches/org.carthage.CarthageKit/dependencies/TKRubberPageControl) failed with exit code 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled

@TBXark

How to apply a shadow?

Firstly, thank you for a great library.

How can I apply a shadow to the TKRubberPageControl? Now the view looks like is on the same level of the background. Thanks

Properties should be public

Hi, this looks great, but I'm having trouble installing it with Cocoapods. The main issue is that the project seems to be missing access control.

I can see that currently, in master, the class and the style struct are public, but the properties are not. This means that we can't set them after init and we can't listen for value changes.

😂

是赵日天啦~

current index problem

   page.numberOfpage = 3
   page.currentIndex = 2

if i set number of page and currentIndex it doesnt show current index and also when i set so there is issue in desing
simulator screen shot - iphone se - 2017-10-04 at 15 56 16

有个BUG

当有10个的时候,第一个小球和第十个小球不能点击。

Can't change the controller on click the button.

Can we change the controller on my own custom button click. because i need this stuff in my app, but i didn't find such function from which i can change the position of the controller. It only change on tap.
Please make it on button click also.

Documentation - English version

Your library seems very nice, but the documentation is in Chinese (?).

Could you please write the documentation in English?

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.