Git Product home page Git Product logo

itprogressindicator's Introduction

ITProgressIndicator

A replacement class for NSProgressIndicator driven by Core Animation. It's highly customisable and much more efficient than NSProgressIndicator.

ITProgressInidicator was created for Play by Play, development funded by David Keegan.

Usage

Copy files

Copy the following files:

  • ITProgressIndicator.h
  • ITProgressIndicator.m

Make sure to copy them to the project, and to add them to the target.

Use in a project

Make sure to check out the sample project. Simply drag a custom view onto your window and set it's custom class to ITProgressIndicator.

It's advised to embed your progress indicator into a layer-backed view! Look at the demo application for clarifaction.

To customise your progress indicator, use the following properties:

/// @property isIndeterminate - Indicates if the view will show the progress, or just spin
@property (nonatomic, setter = setIndeterminate:) BOOL isIndeterminate;

/// @property progress - The amount that should be shown when `isIndeterminate` is set to `YES`
@property (nonatomic) CGFloat progress;

/// @property animates - Indicates if the view is animating
@property (nonatomic) BOOL animates;

/// @property hideWhenStopped - Indicates if the view will be hidden if it's stopped
@property (nonatomic) BOOL hideWhenStopped;

/// @property lengthOfLine - The length of a single line
@property (nonatomic) CGFloat lengthOfLine;

/// @property widthOfLine - The width of a single line
@property (nonatomic) CGFloat widthOfLine;

/// @property numberOfLines - The number of lines of the indicator
@property (nonatomic) NSUInteger numberOfLines;

/// @property innerMargin - The distance of the lines from the middle
@property (nonatomic) CGFloat innerMargin;

/// @property animationDuration - Duration of a single rotation
@property (nonatomic) CGFloat animationDuration;

/// @property gradualAnimation - Defines if the animation is smooth or gradual
@property (nonatomic) BOOL steppedAnimation;

/// @property color - The color of the progress indicator
@property (nonatomic, strong) NSColor *color;

You can also override the following method to achieve your own custom animation:

/**
 *  Override this method to achieve a custom animation
 *
 *  @return CAKeyframeAnimation - animation which will be put on the progress indicator layer
 */
- (CAKeyframeAnimation *)keyFrameAnimationForCurrentPreferences;

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.