Step--1:UIProgressView
UIProgressView*progressview = [[UIProgressViewalloc] init];
//设置属性
progressview.backgroundColor= [UIColorgrayColor];
progressview.alpha= 0.8;
progressview.frame= CGRectMake(10,10,150,20);
//设置风格
progressview.progressViewStyle= UIProgressViewStyleDefault;
//设置当前进度(0~1)float 类型
progressview.progress= 0.7;
//显示填充部分颜色
progressview.progressTintColor= [UIColorblueColor];
//显示未填充部分的颜色
progressview.trackTintColor= [UIColorgreenColor];
//设置填充进度条的部分的图像
//[progressview setProgressImage:[UIImage imageNamed:@""]];
//未填充的轨道部分的图像
//[progressview setTrackImage:[UIImage imageNamed:@""]];
[self.viewaddSubview:progressview];
Step--1:UIActivityIndicatorView
UIActivityIndicatorView*activityindicator = [[UIActivityIndicatorViewalloc] initWithFrame:CGRectMake(10,10, 100, 100)];
activityindicator.backgroundColor= [UIColorcolorWithWhite:0.5alpha:0.5];
/*设置风格
UIActivityIndicatorViewStyleWhiteLarge,
UIActivityIndicatorViewStyleWhite,
UIActivityIndicatorViewStyleGray
*/
activityindicator.activityIndicatorViewStyle= UIActivityIndicatorViewStyleWhiteLarge;
//一个布尔值,用于控制在动画停止时是否隐藏接收者
activityindicator.hidesWhenStopped= YES;
//启动
[activityindicator startAnimating];
//暂停
//[activityindicator stopAnimating];
//状态
//activityindicator.isAnimating;
//设置活动指标的颜色
activityindicator.color= [UIColorblueColor];
[self.viewaddSubview:activityindicator];
网友评论