1 前言
UIProgressView控件用来显示进度条描述某个任务的进度。
2 代码实例
ZYViewController.h:
#import <UIKit/UIKit.h>
@interface ZYViewController : UIViewController
@property(nonatomic,strong) UIProgressView *progressView;
@end
ZYViewController.m:
@synthesize progressView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor];
self.progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];//初始化条状进度条
self.progressView.center = self.view.center;
self.progressView.progress = 0.5f;//设置进度条进度为50%
[self.view addSubview:self.progressView];
}
运行结果:
3 结语
以上就是对UIProgressVIew控件的介绍,希望对大家有所帮助。