Giter Site home page Giter Site logo

sansuinanhai / circularprogressview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nijino/circularprogressview

0.0 2.0 0.0 4.49 MB

An audio circular progress view for iOS.You can customize its frame,background circle color & progress circle color,circle width as you wish. 一个iOS圆形进度条开源库,你可以定制它的大小、进度条背景色和前景色以及进度条的宽度。

Home Page: http://www.nijino.cn

License: Other

Objective-C 95.18% Ruby 4.82%

circularprogressview's Introduction

Introduction 简介

A custom audio circular progress view for iOS.You can customlize its frame,background circle color & progress circle color and circle width as you wish.
一个iOS圆形进度条开源库,你可以定制它的大小、进度条背景色和前景色以及进度条的宽度。
example pic

Latest Update 最新更新内容

Now you can drag the progress to precise location to where it should to play.
现在支持拖拽进度以便精确控制播放进度。

Installation 安装方法

1.Add AVFoundation.framework into your project.
1.在工程项目中加入AVFoundation.framework & QuartzCore.framework框架。

2.Drop "CircularProgressView.h" & "CircularProgressView.m" into your project.
2.将“CircularProgressView.h”和“CircularProgressView.m”文件拖拽至工程目录。

Usage 使用方法

First in your ViewController import the header file CircularProgressView.h, and create a CircularProgressView property to keep a reference:
首先在你的ViewController中导入CircularProgressView.h头文件并且新建一个圆形进度条属性来作为一个引用:
@property (nonatomic) CircularProgressView *circularProgressView;
Then you can create circular progress view by Interface Builder or by code.
之后你可以通过Interface Builder方式或者写代码的方式新建一个圆形进度条。

1.To create by using Interface Builder:
1.通过Interface Builder建立:
Drop a UIView object into your xib or storyboard file, modify its class name to CircularProgressView:
在你的Xib或者故事版文件中放下一个UIView对象,修改它的类名为CircularProgressView:
xib example
then define circular progress view propertys in viewDidLoad method like this:
之后如下方式在viewDidLoad方法中定义圆形进度条的属性:

    self.circularProgressView.backColor = [UIColor colorWithRed:236.0 / 255.0
                                                          green:236.0 / 255.0
                                                           blue:236.0 / 255.0
                                                          alpha:1.0];
    self.circularProgressView.progressColor = [UIColor colorWithRed:82.0 / 255.0
                                                              green:135.0 / 255.0
                                                               blue:237.0 / 255.0
                                                              alpha:1.0];
    self.circularProgressView.audioURL = [[NSBundle mainBundle] URLForResource:@"我的歌声里" withExtension:@"mp3"];

    self.circularProgressView.lineWidth = 20;

    //set CircularProgressView delegate
    self.circularProgressView.delegate = self;

2.To create the object using codes like this:
2.用写代码的方式建立对象:

    //get a audio path
    NSURL *audioURL = [[NSBundle mainBundle] URLForResource:@"我的歌声里" withExtension:@"mp3"];
    //set back color & progress color
    UIColor *backColor = [UIColor colorWithRed:236.0/255.0 
	       								 green:236.0/255.0 
			     						  blue:236.0/255.0 
				    					 alpha:1.0];
    UIColor *progressColor = [UIColor colorWithRed:82.0/255.0 
									       	green:135.0/255.0 
										     blue:237.0/255.0 
										    alpha:1.0];
    
    //alloc CircularProgressView instance
    self.circularProgressView = [[CircularProgressView alloc] initWithFrame:CGRectMake(41, 57, 238, 238) 
															  backColor:backColor 
														  progressColor:progressColor 
															  lineWidth:30 
															  audioURL:audioURL];
    //set CircularProgressView delegate
    self.circularProgressView.delegate = self;
    //add CircularProgressView
    [self.view addSubview:self.circularProgressView];

API 提供接口

You can play,pause & stop audio by below methods declared in the header file CircularProgressView.h
你可以通过如下方法播放、暂停或者停止音频,这些方法声明在CircularProgressView.h头文件中:

- (void)play;
- (void)pause;
- (void)stop;

Demo 示例

You can find a demo project in this repository.
你可以在这个开源库中找到一个示例工程。

Version History 版本信息

  • version 1.5
    Replace NSTimer with CADisplayLink.
    用CADisplayLink替换NSTimer。

  • version 1.4
    Update to supporting Xcode5. Add animation to tap & drag gesture.
    升级支持到Xcode5,加入点击与拖拽的手势动画。

  • version 1.3
    Add response drag progress view gesture.
    加入对拖拽进度手势的响应。

  • version 1.2
    Add initWithCoder method for creating instance from Interface Builder.
    加入对通过Interface Builder建立实例的初始化方法initWithCoder方法的支持。

  • version 1.1
    Make code easy to read,add licenece and pics.
    让代码更易读,加入许可证和截图。

  • version 1.0
    Initial version.
    初始版本。

Requirements 系统要求

  • iOS >= 4.3
  • ARC

Contact 联系方式

circularprogressview's People

Contributors

nijino avatar

Watchers

James Cloos 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.