当前位置:编程学习 > wap >>

IOS开发(20)之UIProgressView控件

1 前言
UIProgressView控件用来显示进度条描述某个任务的进度。

2 代码实例
ZYViewController.h:


[plain] view plaincopyprint?#import <UIKit/UIKit.h> 
 
@inte易做图ce ZYViewController : UIViewController 
 
@property(nonatomic,strong) UIProgressView *progressView; 
 
@end 

#import <UIKit/UIKit.h>

@inte易做图ce 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];//初始化条状进度条 
    self.progressView.center = self.view.center; 
    self.progressView.progress = 0.5f;//设置进度条进度为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];//初始化条状进度条
    self.progressView.center = self.view.center;
    self.progressView.progress = 0.5f;//设置进度条进度为50%
    [self.view addSubview:self.progressView];
}
运行结果:

 

 

\
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,