
//
// 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

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现