简单的写个progress练个手,希望对看官有所帮助
UIProgressView * progerssView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
progerssView.frame = CGRectMake(0, 300, 300, 10);progerssView.backgroundColor = [UIColor lightGrayColor];
//改变进度条高度
progerssView.transform = CGAffineTransformMakeScale(1.0, 10.0);
//裁剪圆角
progerssView.layer.cornerRadius = 10;
progerssView.layer.masksToBounds = YES;
//进度条颜色
progerssView.progressTintColor = [UIColor redColor];
[self.view addSubview:progerssView];
CGFloat value = 0.70;
UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(progerssView.frame), 294,100, 20)];
lable.font = [UIFont boldSystemFontOfSize:15];
lable.textColor = [UIColor blackColor];
lable.text = [[NSString stringWithFormat:@"%.1f",value*100]stringByAppendingString:@"%"];
[progerssView setProgress:value animated:YES];
[self.view addSubview:lable];