TLProgressSpring 1.0.1

TLProgressSpring 1.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布日期最后发布2016 年 5 月

Andrew 维护。



  • 作者:
  • Andrew

<<<<<<< HEAD

示例图片

1

2

3

4

5

6

7

8

9

10

11

12

如何使用

  1. 导航栏进度条用法

首先导入类库 #import <TLProgressSpring/TLNavBarProgressView.h>

键入代码

 TLNavBarProgressView *progressView = [TLNavBarProgressView progressViewforNavigationController:self.navigationController];
    progressView.progressTintColor=[UIColor redColor];

    _progress+= 0.2;

    if(_progress>=1){
        _progress=0;
    }

    [progressView setProgress:_progress animated:YES];
  1. 自定义转轮的用法

导入类库 #import <TLProgressSpring/TLActivityIndicatorView.h>

 _activityIndicatorView = [[TLActivityIndicatorView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    [self.view addSubview:_activityIndicatorView];
    _activityIndicatorView.animatorDuration = 0.8;
    [_activityIndicatorView startAnimating];


 启动:

 -(void)showActivity:(id)sender{
    if(_activityIndicatorView){
        [_activityIndicatorView startAnimating];
    }
}
  1. 带有遮罩效果的各种进度条使用

导入类库 #import <TLProgressSpring/TLOverlayProgressView.h>

首先利用 Block 定义一个延时关闭的方法

- (void)performBlock:(void(^)())block afterDelay:(NSTimeInterval)delay {
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), block);
}
  • 默认转轮进度条用法
-(void)onShowProgress0{
    TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
                                              showOverlayAddTo:[self rootView]
                                              title:nil
                                              style:TLOverlayStyleIndeterminate
                                              animated:YES stopBlock:^(TLOverlayProgressView *progressView) {

                                                  [progressView hideAnimated:YES];
                                              }];
    [overLayProgress showAnimated:YES];
    [self performBlock:^{
        [overLayProgress dismiss:YES];
    } afterDelay:2.0];
}
  • 显示失败的图标

-(void)onShowProgress1{
    TLOverlayProgressView *overlayProgress=[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"Failier" style:TLOverlayStyleCrossIcon animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
        [progressView hideAnimated:YES];
    }];

    [overlayProgress showAnimated:YES];
    [self performBlock:^{
        [overlayProgress dismiss:YES];
    } afterDelay:2.0];

}
  • 显示成功的图标
-(void)onShowProgress2{
    TLOverlayProgressView *overlayProgress=[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"Success" style:TLOverlayStyleCheckmarkIcon animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
        [progressView hideAnimated:YES];
    }];

    [overlayProgress showAnimated:YES];
    [self performBlock:^{
        [overlayProgress dismiss:YES];
    } afterDelay:2.0];

}
  • 显示百分比的水平方向的进度条
-(void)onShowProgress3{
    TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
                                              showOverlayAddTo:self.view
                                              title:@"loading"
                                              style:TLOverlayStyleHorizontalBar
                                              animated:YES];
    overLayProgress.isShowPercent=YES;
    [overLayProgress showAnimated:YES];
    [self simulateProgress:overLayProgress];

}
  • 显示小图标的进度条
-(void)onShowProgress4:(TLOverlayStyle )style{
    TLOverlayProgressView *progress = [TLOverlayProgressView showOverlayAddTo:self.view
                                                                        title:@"loading..."
                                                                        style:TLOverlayStyleIndeterminateSmall
                                                                     animated:YES stopBlock:^(TLOverlayProgressView *progressView) {

                                                                         [progressView dismiss:YES];
                                                                     }];
    [self performBlock:^{
        [progress dismiss:YES];
    } afterDelay:2.0];
}
  • 显示圆环进度条
-(void)onShowProgress5{
    TLOverlayProgressView *overlayProgressView =[TLOverlayProgressView showOverlayAddTo:[self rootView] title:@"" style:TLOverlayStyleDeterminateCircular animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
        [progressView hideAnimated:YES];
    }];
    [overlayProgressView showAnimated:YES];

    [self simulateProgress:overlayProgressView];
}
  • 显示苹果系统自带的 ActivityIndicator
-(void)onShowProgress7{
    TLOverlayProgressView *overLayProgress = [TLOverlayProgressView
                                              showOverlayAddTo:self.view
                                              title:@"Loading..."
                                              style:TLOverlayStyleSystemUIActivity
                                              animated:YES stopBlock:^(TLOverlayProgressView *progressView) {
                                                  [progressView hideAnimated:YES];
                                              }];
    [overLayProgress showAnimated:YES];
    [self performBlock:^{
        [overLayProgress dismiss:YES];
    } afterDelay:2.0];
}

示例

要运行示例项目,首先克隆仓库,然后从示例目录运行 pod install

要求

安装

TLProgressSpring 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行

pod "TLProgressSpring"

作者

Andrew, [email protected]

许可证

TLProgressSpring 遵循 MIT 许可。有关更多信息,请参阅 LICENSE 文件。

一款进度条工具类,可以在导航栏上显示,也可以弹出一个转轮显示,用户随时可交互

e7a0f294260c4687ab69a6d47ec40498dcee80bc