KAProgressLabel 3.3.3

KAProgressLabel 3.3.3

测试已测试
语言语言 Obj-CObjective C
许可 未知
发布上次发布2018年4月

Alexis CreuzotAlexis Creuzot 维护。



  • Alexis Creuzot

Language CocoaPods Compatible Build Status

KAProgressLabel

带有样式、动画、交互等功能的 iOS 循环进度标签。

演示 1

KAProgressLabel

演示 2

无限可能! KAProgressLabel

安装

安装Lame

  • KAProgressLabel/KAProgressLabel文件夹复制到您的项目中。
  • 从您的.pch文件中导入KAProgressLabel.h

使用CocoaPods

将以下行添加到您的Podfile中

pod 'KAProgressLabel'

用法

样式

颜色

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

宽度

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

起始和结束标签

可以在进度弧的开始和结束处显示(非常)小的文本,通过2个专门的标签。您可以按照自己的方式设置这个标签。

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

进度

如果你只想显示进度,那很简单。

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

特定的起始/结束度数

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

用户交互

你可以允许用户与startDegreeendDegree进行交互。默认情况下,用户交互是禁用的。

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

动画

你可以对startDegreeendDegreeprogress进行动画处理。

- (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;

可以停止已开始的动画。

- (void)stopAnimations;

你还可以使用labelAnimCompleteBlock块在动画结束时添加一些自定义逻辑。

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