Git Product home page Git Product logo

kaprogresslabel's Introduction

KAProgressLabel

Circular progress label for iOS with styling, animations, interaction and more.

Demo 1

KAProgressLabel

Demo 2

Endless possibilities! KAProgressLabel

Installing

Lame install

  • Copy the KAProgressLabel/KAProgressLabel folder into your project.
  • Import KAProgressLabel.h from your .pch file

Using CocoaPods

Add this line to your Podfile:

pod 'KAProgressLabel'

Usage

Style

Colors

self.myProgressLabel.fillColor = [UIColor blackColor];
self.myProgressLabel.trackColor = [UIColor redColor];
self.myProgressLabel.progressColor = [UIColor greenColor];

Widths

self.myProgressLabel.trackWidth = 2.0;         // Defaults to 5.0
self.myProgressLabel.progressWidth = 4;        // Defaults to 5.0
self.myProgressLabel.roundedCornersWidth = 10; // Defaults to 0

Start and end labels

A (very) small text can be display at the start and end of the progress arc, via 2 dedicated labels. You can style this label any way you want.

self.myProgressLabel.startLabel.text = @"S";
self.myProgressLabel.endLabel.text = @"E";

Arc

Progress

If you only want to show a progress, it's straightforward.

// Progress must be between 0 and 1
self.myProgressLabel.progress = 0.5;

Specific start/end degrees

- (void)setStartDegree:(CGFloat)startDegree;
- (void)setEndDegree:(CGFloat)endDegree;

User interaction

You can allow the user to interact with both startDegree and endDegree. By default, user interaction is disabled.

// Activate user interaction on both sides
self.myProgressLabel.isStartDegreeUserInteractive = YES;
self.myProgressLabel.isEndDegreeUserInteractive = YES;

Animations

You can animate startDegree, endDegree and progress.

- (void)setStartDegree:(CGFloat)startDegree
               timing:(TPPropertyAnimationTiming)timing
             duration:(CGFloat)duration
                delay:(CGFloat)delay;

- (void)setEndDegree:(CGFloat)endDegree
             timing:(TPPropertyAnimationTiming)timing
           duration:(CGFloat)duration
              delay:(CGFloat)delay;

- (void)setProgress:(CGFloat)progress
            timing:(TPPropertyAnimationTiming)timing
          duration:(CGFloat)duration
             delay:(CGFloat)delay;

It's possible to stop an already started animation.

- (void)stopAnimations;

You can also add some custom logic at the end of an animation using the labelAnimCompleteBlock block.

self.myProgressLabel.labelAnimCompleteBlock = ^(KAProgressLabel *label) {
    NSLog(@"Animation complete !");
};

kaprogresslabel's People

Contributors

alexgaribay avatar alexiscreuzot avatar blixt avatar cariosvertel avatar codyhazelwood avatar infolock avatar revolter avatar stevesparks avatar ulazdins avatar

Watchers

 avatar  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.