Giter Site home page Giter Site logo

chbeer / ffcircularprogressview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from franzhcs/ffcircularprogressview

0.0 2.0 0.0 1.55 MB

FFCircularProgressView - An iOS 7-inspired blue circular progress view

License: MIT License

Ruby 6.94% Objective-C 93.06%

ffcircularprogressview's Introduction

FFCircularProgressView Build Status

FFCircularProgressView - An iOS 7-inspired blue circular progress view

ss1 ss2 ss3 ss4 Carthage compatible

This progress view is inspired by the new progress view in the App Store, iOS 7. Also the colors are taken from there.

See it in action

sample

Requirements

FFCircularProgressView works on iOS version > 5 and is compatible with both ARC and non-ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework
  • UIKit.framework
  • CoreGraphics.framework
  • QuartzCore.framework

You will need LLVM 3.0 or later in order to build FFCircularProgressView.

Adding FFCircularProgressView to your project

There are plenty of ways to add this view to your project. Make sure you add the aforementioned frameworks to your project as well.

GIT submodule

You have the canonical git submodule option. Simply issue git submodule add https://github.com/elbryan/FFCircularProgressView.git <path> in your root folder of your repository.

CocoaPods

  1. Add a pod entry to your Podfile dependencies file such as pod 'FFCircularProgressView', '>= 0.1'.
  2. Install the pod(s) by running pod install.
  3. Import the progress view with `#import "FFCircularProgressView.h" wherever you need in your project.

Source files

Manually add the source files to your project. The files you need are 'FFCircularProgressView.h', 'FFCircularProgressView.m', 'UIColor+iOS7.h', 'UIColor+iOS7.m'.

Usage

Just use it as it is a normal UIProgressView. Make sure you set the progress value in the main thread ;)

double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND,0), ^{
        for (float i=0; i<1.1; i+=0.01F) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [circularProgressView setProgress:i];
            });
            usleep(10000);
        }            
    });
});

You can also control the progress view spin animation by using the following two methods to start and stop the spinning, respectively:

// Start spinning
[circularProgressView startSpinProgressBackgroundLayer];

// Stop spinning
[circularProgressView stopSpinProgressBackgroundLayer];

Acknowledgments

The code to draw the tick has been adapted from GSProgressView.

License

This code is distributed under the terms and conditions of the MIT license.

Attributions

I do not demand to be mentioned in your apps nor to receive any kind of compensation if you use this code. Yet, I would like to have feedbacks if you use it and you like it.

Follow me on Twitter: @elbryanlos

Android

Are you an Android developer and you love this progress view? No problem! A couple of folks ported it to Android OS and you can get it here.

Thank you guys!

ffcircularprogressview's People

Contributors

chandlewei avatar chbeer avatar el-coco avatar franzhcs avatar j5136p1 avatar legoless avatar neilkimmett avatar pronebird avatar yangcheng 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.