IOS开发(20)之UIProgressView控件

来源:互联网 发布:移动手机网络制式 编辑:程序博客网 时间:2024/06/06 01:30

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控件的介绍,希望对大家有所帮助。

Demo代码实例:http://download.csdn.net/detail/u010013695/5303795

原创粉丝点击