1 Preface
The UIProgressView control is used to display the progress bar that describes the progress of a task.
 
2. code example
ZYViewController. h:
 
[Plain] view plaincopyprint? # Import <UIKit/UIKit. h>
 
@ Interface ZYViewController: UIViewController
 
@ Property (nonatomic, strong) UIProgressView * progressView;
 
@ End
 
# Import <UIKit/UIKit. h>
 
@ Interface ZYViewController: UIViewController
 
@ Property (nonatomic, strong) UIProgressView * progressView;
 
@ End
ZYViewController. m:
 
[Plain]
@ 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]; // initialize a bar progress bar
Self. progressView. center = self. view. center;
Self. progressView. progress = 0.5f; // set the progress bar to 50%.
[Self. view addSubview: self. progressView];
}
 
@ 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]; // initialize a bar progress bar
Self. progressView. center = self. view. center;
Self. progressView. progress = 0.5f; // set the progress bar to 50%.
[Self. view addSubview: self. progressView];
}
Running result: