simpliflow/SFRoundProgressCounterView

语言: Objective-C

git: https://github.com/simpliflow/SFRoundProgressCounterView

README.md (中文)

SFRoundProgressCounterView

自定义UIView,圆形进度条和圆形中心的计数器。 支持多个时间间隔(以毫秒为单位),启动/停止/恢复计数器,设置自定义颜色等(参见示例项目)

Alt text
Alt text

建立

使用CocoaPods安装

如果您不熟悉CocoaPods,可以在这里查看本教程。

  1. 在终端中导航到项目的根目录。
  2. 运行'touch Podfile'以创建Podfile。
  3. 使用'open -e Podfile'打开Podfile
  4. 将pod SFRoundProgressCounterView添加到Podfile。 平台:ios,'7.0' pod'SFRoundProgressCounterView'
  5. 运行pod安装。
  6. 打开应用程序的.xcworkspace文件以启动Xcode并开始使用该控件!

用法

  1. 通过从故事板中拖动UIView来创建SFRoundProgressCounterView并更改实现类或以编程方式创建它
  2. 创建一个插座(如果通过故事板创建)
  3. 设置时间间隔 self.sfProgressCounterView.delegate = self; NSNumber * interval = [NSNumber numberWithLong:5000.0]; self.sfProgressCounterView.intervals = @ [interval]; //你也可以定义多个间隔 //self.sfProgressCounterView.intervals = @ [interval,interval,interval];
  4. 反互动 [self.sfProgressCounterView start]; [self.sfProgressCounterView stop]; [self.sfProgressCounterView resume]; [self.sfProgressCounterView reset];
  5. 外观设置 //外圈的厚度 self.sfProgressCounterView.outerCircleThickness = [NSNumber numberWithFloat:3.0]; //内圈的厚度 self.sfProgressCounterView.innerCircleThickness = [NSNumber numberWithFloat:1.0]; //跟踪外圈的颜色 self.sfProgressCounterView.innerTrackColor = [UIColor redColor]; //跟踪内圈的颜色 self.sfProgressCounterView.outerTrackColor = [UIColor blackColor]; //两个圆之间的距离(如果有多个间隔) self.sfProgressCounterView.circleDistance = [NSNumber numberWithFloat:6.0]; //设置外部进度圆的颜色 self.sfProgressCounterView.outerProgressColor = color; //设置内部进度圆的颜色 self.sfProgressCounterView.innerProgressColor = color; //设置计数器标签的颜色 self.sfProgressCounterView.labelColor = color; //隐藏分数 self.sfProgressCounterView.hideFraction = YES;

代表方法

    - (void)countdownDidEnd:(SFRoundProgressCounterView*)progressCounterView;
    - (void)intervalDidEnd:(SFRoundProgressCounterView*)progressCounterView WithIntervalPosition:(int)position;
    - (void)counter:(SFRoundProgressCounterView *)progressCounterView didReachValue:(unsigned long long)value;

作者(S)

Simpliflow GmbH

托马斯温克勒

许可证

根据MIT许可证分发。

归因

TTCounterLabel

CERoundProgressView

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

SFRoundProgressCounterView

A custom UIView with a rounded progress bar and a counter in the center of the circle.
Supports multiple time intervals (in milliseconds), start/stop/resuming counter, set custom color, etc. (see example project)

Alt text
Alt text

Setup

Installing with CocoaPods

If you're unfamiliar with CocoaPods you can check out this tutorial here.

  1. In Terminal navigate to the root of your project.
  2. Run 'touch Podfile' to create the Podfile.
  3. Open the Podfile using 'open -e Podfile'
  4. Add the pod SFRoundProgressCounterView to your Podfile.

    platform :ios, '7.0'
    pod 'SFRoundProgressCounterView'
    
  5. Run pod install.

  6. Open your app's .xcworkspace file to launch Xcode and start using the control!

Usage

  1. Either create SFRoundProgressCounterView by dragging UIView from storyboard and change implementing class or create it programmatically
  2. Create an outlet (if create via storyboard)
  3. Set up time intervals

    self.sfProgressCounterView.delegate = self;
    NSNumber* interval = [NSNumber numberWithLong:5000.0];
    self.sfProgressCounterView.intervals = @[interval];
    // you could also define multiple intervals
    //self.sfProgressCounterView.intervals = @[interval, interval, interval];
    
  4. Counter interaction

    [self.sfProgressCounterView start];
    [self.sfProgressCounterView stop];
    [self.sfProgressCounterView resume];
    [self.sfProgressCounterView reset];
    
  5. Appearance Settings

    // thickness of outer circle
    self.sfProgressCounterView.outerCircleThickness = [NSNumber numberWithFloat:3.0];
    
    // thickness of inner circle
    self.sfProgressCounterView.innerCircleThickness = [NSNumber numberWithFloat:1.0];
    
    // track color of outer circle
    self.sfProgressCounterView.innerTrackColor = [UIColor redColor];
    
    // track color of inner circle
    self.sfProgressCounterView.outerTrackColor = [UIColor blackColor];
    
    // distance between two circles (if multiple intervals)
    self.sfProgressCounterView.circleDistance = [NSNumber numberWithFloat:6.0];
    
    // set color of outer progress circles
    self.sfProgressCounterView.outerProgressColor = color;
    
    // set color of inner progress circle
    self.sfProgressCounterView.innerProgressColor = color;
    
    // set color of counter label
    self.sfProgressCounterView.labelColor = color;
    
    // hide fraction 
    self.sfProgressCounterView.hideFraction = YES;
    

Delegate Methods

    - (void)countdownDidEnd:(SFRoundProgressCounterView*)progressCounterView;
    - (void)intervalDidEnd:(SFRoundProgressCounterView*)progressCounterView WithIntervalPosition:(int)position;
    - (void)counter:(SFRoundProgressCounterView *)progressCounterView didReachValue:(unsigned long long)value;

Author(s)

Simpliflow GmbH

Thomas Winkler

Licence

Distributed under the MIT License.

Attributation

TTCounterLabel

CERoundProgressView