THCircularProgressView.h 的使用方法

//
//  MainViewController.m
//  fitmiss
//
//  Created by bill on 13-4-11.
//  Copyright (c) 2013年 lear. All rights reserved.
//

#import "MainViewController.h"
#import "RootTabBarController.h"
#import "MLNavigationController.h"
#import "THCircularProgressView.h"
#import "Function.h"

#import "textViewController.h"

@interface MainViewController ()

@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic) CGFloat percentage;
@property (nonatomic) CGFloat percentageEnd;
@property (nonatomic) THCircularProgressView *roundProgressBar;

@end

@implementation MainViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];

    self.percentage = 0;
    self.percentageEnd = 0.75;
    self.timer = [NSTimer scheduledTimerWithTimeInterval:0.01
                                                  target:self
                                                selector:@selector(timerFired:)
                                                userInfo:nil
                                                 repeats:YES];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    self.roundProgressBar.percentage = 0;
    [self.timer invalidate];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIView *rootView = [[UIView alloc]init];

    rootView.frame = CGRectMake(0, 0, [Function getScreenWidth], [Function getScreenHeight] - 49);
    rootView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:rootView];
//主要区域
    UIView *taskView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [Function getScreenWidth], 216)];
    taskView.backgroundColor = [Function colorWithHexString:@"#f5f0eb"];
    [rootView addSubview:taskView];

    //添加圆----------------------------------------------------------------
    UIView *roundView = [[UIView alloc]initWithFrame:CGRectMake(0, 40, 176, 176)];
    //添加圆形的进度条
    self.percentage = 0;
    //self.percentageEnd = 1;
    self.roundProgressBar = [[THCircularProgressView alloc] initWithCenter:CGPointMake(88, 88)
                                                           radius:87
                                                        lineWidth:88.0f
                                                     progressMode:THProgressModeFill
                                                    progressColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"round_show"]]
                                           progressBackgroundMode:THProgressBackgroundModeCircumference
                                          progressBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"round_bg"]]
                                                       percentage:self.percentage];
    [roundView addSubview:self.roundProgressBar];

    //添加圆的按钮及上面的文字
    UIImage *roundButtonImg = [UIImage imageNamed:@"round_button"];
    UIButton *roundButton = [UIButton buttonWithType:UIButtonTypeCustom];
    roundButton.frame = CGRectMake(22, 22, roundButtonImg.size.width, roundButtonImg.size.height);
    [roundButton setBackgroundImage:roundButtonImg forState:UIControlStateNormal];
    UILabel *buttonLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 132, 132)];
    buttonLabel.backgroundColor = [UIColor clearColor];
    buttonLabel.text = @"08";
    buttonLabel.textAlignment = 1;
    buttonLabel.shadowColor = [UIColor grayColor];
    buttonLabel.shadowOffset = CGSizeMake(0.5,0.5);
    buttonLabel.textColor = [Function colorWithHexString:@"#3f3f3f"];
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) {
        buttonLabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:70.0f];
    }else{
        buttonLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:60.0f];
    }
    [roundButton addTarget:self action:@selector(renwuButtenClick:) forControlEvents:UIControlEventTouchUpInside];
    [roundButton addSubview:buttonLabel];

    UILabel *buttonLabelTop = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 132, 30)];
    buttonLabelTop.backgroundColor = [UIColor clearColor];
    buttonLabelTop.text = @"未完成任务";
    buttonLabelTop.textAlignment = 1;
    buttonLabelTop.textColor = [Function colorWithHexString:@"#555555"];
    buttonLabelTop.font = [UIFont systemFontOfSize:11];
    [roundButton addSubview:buttonLabelTop];

    UILabel *buttonLabelButtom = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, 132, 30)];
    buttonLabelButtom.backgroundColor = [UIColor clearColor];
    buttonLabelButtom.text = @"点击执行";
    buttonLabelButtom.textAlignment = 1;
    buttonLabelButtom.textColor = [Function colorWithHexString:@"#555555"];
    buttonLabelButtom.font = [UIFont systemFontOfSize:14];
    [roundButton addSubview:buttonLabelButtom];

    [roundView addSubview:roundButton];
    //---------------------------------------------------------------------
    [taskView addSubview:roundView];

}

- (void)timerFired:(NSTimer *)timer
{
    self.percentage += 0.01;
    if (self.percentage >= self.percentageEnd) {
        [self.timer invalidate];
    }

    self.roundProgressBar.percentage = self.percentage;

}

@end

THCircularProgressView.h 的使用方法

时间: 2024-08-22 12:16:54

THCircularProgressView.h 的使用方法的相关文章

C/C++:多个.cpp文件包含同一个.h头文件定义方法

本文解决multiple definition of `XX'的错误.[出于反爬虫的目的,你不是在http://blog.csdn.net/zhanh1218上看到的,肯定不是最新最全的.] 关于头文件的定义中,请一定加上以下代码(此为头文件保护符): <span style="font-size:14px;"><span style="font-size:12px;">#ifndef PERSON_H_ #define PERSON_H_

关于控制台头文件stdafx.h的解决方法。

大概在不久前用 C语言实现播放器的时候看到相关的代码里有这个头文件,在codeblocks和vc++里面单文件都无法编译,而且就算使用 appwizard也只出现了可以编译但是无法运行的尴尬情况.网上的关于stdafx.h的解决方法全都是说"恩恩很简单"或者"我的编译没问题啊" 其实仅仅打开看这个头文件确实不太难/*测试一下插入代码插件*/,解决办法就是把这堆代码复制一下到自己新建的"stdafx.h"里面,之后 放在和你的源文件一个目录下面就行

VS2010中&lt;无法打开包括文件:“iostream.h”:&gt;错误解决方法

C/C++ code? 1 2 #include <iostream.h> 改为: C/C++ code? 1 2 #include <iostream> using namespace std; VS2010中<无法打开包括文件:"iostream.h":>错误解决方法

VS2013/2012 下无法打开 源 文件“stdafx.h”的解决方法

VS2013/2012下代码一写上去保存就报错了,下方提示无法打开 源 文件"stdafx.h" 如图: 百度了一下,对于VS2010有这样的方法可以解决: 在项目属性中展开C/C++,选择常规,在附加包含目录里加入"$(ProjectDir)" 大家可以看到在我的VS2013下完全没作用. 后来发现这样就成功了: 那个预编译头文件是自己就有的,我想VS2013/2012默认就包含了"stdafx.h"吧,所以不必再写一次 VS2013/2012

安卓实战开发之JNI入门及高效的配置(android studio一键生成.h,so及方法签名)

前言 以前也讲过NDK开发,但是开始是抱着好玩的感觉去开始的,然后呢会helloWord就觉得大大的满足,现在静下来想这NDK开发到底是干什么呢? NDK开发,其实是为了项目需要调用底层的一些C/C++的一些东西:另外就是为了效率更加高效些但是在java与C相互调用时平白又增大了开销(其实效率不见得有所提高),然后呢,基于安全性的考虑也是为了防止代码被反编译我们为了安全起见,使用C语言来编写这些重要的部分来增大系统的安全性,最后呢生成so库便于给人提供方便. 好了,我们来看一下qq的结构,我们就

关于 apue.h 的使用方法

unix中有很多地方使用到apue.h  .apue.h是作者自己写的一个头文件,这个文件怎么用,晚上有很多方法,但是经过尝试大多不好用. 经过本人尝试,可以把src.3e.tar.gz 的代码解压到 /usr/local/include/下边.使用apue.h的时候修改引入的头就可以来.本人使用的是centos6.5. 一下为测试代码: #include "/usr/local/include/include/apue.h" #define BUFFSIZE 4096 void ma

关于【cocos2dx-3.0beta-制作flappybird】教程在3.2工程中出现找不到CCMenuItem.h的解决方法

文章原文:http://blog.csdn.net/kantian_/article/details/36187141 作者升级源代码,可以在3.1平台下运行. 我的是vs2013+cocos2dx-3.2. 本来以为按照作者的方法新建工程后可以用,没想到总出现这个[无法打开包括文件: "CCMenuItem.h": No such file or directory]. 问题其实简单,就是找不到,这个找不到其实是没有在工程中包含要引用的头文件的文件路径.一般此类问题都是这样. 在  

C/C++:多个.cpp文件包括同一个.h头文件定义方法

本文解决multiple definition of `XX'的错误.[出于反爬虫的目的,你不是在http://blog.csdn.net/zhanh1218上看到的,肯定不是最新最全的.] 关于头文件的定义中,请一定加上下面代码(此为头文件保护符): <span style="font-size:14px;"><span style="font-size:12px;">#ifndef PERSON_H_ #define PERSON_H_

Ubuntu18.4.3安装python-ldap找不到lber.h的解决方法

利用pip install python-ldap出现编译错误: Modules/errors.h:8:18: fatal error: lber.h: 没有那个文件或目录 经过一番搜寻,在StackOverflow上找到的解决方法: sudo apt-get install libldap2-dev 这时错误变成了sasl.h缺失,继续安装: sudo apt-get install libsasl2-dev 原文地址:https://www.cnblogs.com/ben9518chen/p