/*_____________________________UIProgressView_____________________________*/
- (void)_initProgressView {
//数值范围是(0,1)
UIProgressView *progress = [[UIProgressView alloc] initWithFrame:CGRectMake(30, 450, 200, 20)];
progress.tag = 200;
progress.progress = .5;
//设置样式
progress.progressViewStyle = UIProgressViewStyleBar;
//设置进度条的颜色
//已经下载的颜色
// progress.progressTintColor = [UIColor redColor];
//未下载的颜色
// progress.trackTintColor = [UIColor greenColor];
UIImage *image = [UIImage imageNamed:@"com_slider_max_l-Decoded"];
//设置拉伸点
image = [image stretchableImageWithLeftCapWidth:10 topCapHeight:0];
//设置图片(iOS7没有效果)
progress.progressImage = image;
progress.trackImage = image;
[NSTimer scheduledTimerWithTimeInterval:.5
target:self
selector:@selector(timeAction:)
userInfo:nil repeats:YES];
[self.view addSubview:progress];
}
- (void)timeAction:(NSTimer *)time {
//取得视图
UIProgressView *progressView = (UIProgressView *)[self.view viewWithTag:200];
progressView.progress += .05;
}
UIProgressView进度条
最新推荐文章于 2021-03-25 15:19:08 发布