欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

进度条之ADVProgressBar 博客分类: iOS iPhoneiOS进度条ADVProgressBar 

程序员文章站 2024-03-20 09:07:28
...
- (void)viewDidLoad {    
    ADVPercentProgressBar *blueprogressBar = [[ADVPercentProgressBar alloc] initWithFrame:CGRectMake(10, 30, 292, 28) andProgressBarColor:ADVProgressBarBlue];    
    [blueprogressBar setProgress:0.5];    
    [self.view addSubview:blueprogressBar];
    
    ADVPercentProgressBar *greenprogressBar = [[ADVPercentProgressBar alloc] initWithFrame:CGRectMake(10, 80, 292, 28) andProgressBarColor:ADVProgressBarGreen];    
    [greenprogressBar setProgress:0.5];    
    [self.view addSubview:greenprogressBar];
        
    ADVPercentProgressBar *redProgressBar = [[ADVPercentProgressBar alloc] initWithFrame:CGRectMake(10, 130, 292, 28) andProgressBarColor:ADVProgressBarRed];    
    [redProgressBar setProgress:0.5];    
    [self.view addSubview:redProgressBar];
        
    ADVPercentProgressBar *brownProgressPar = [[ADVPercentProgressBar alloc] initWithFrame:CGRectMake(10, 180, 292, 28) andProgressBarColor:ADVProgressBarBrown];
    [brownProgressPar setProgress:0.5];
    [self.view addSubview:brownProgressPar];
    
    progressBars = [NSArray arrayWithObjects:blueprogressBar, redProgressBar, greenprogressBar, brownProgressPar, nil];
    
    UISlider* slider = [[UISlider alloc] initWithFrame:CGRectMake(10, 230, 292, 28)];
    [slider setMaximumValue:1.0];
    [slider setMinimumValue:0.0];
    [slider setValue:0.5];
    [slider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];    
    [self.view addSubview:slider];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 280, 292, 28)];
    [label setText:@"Move the slider to see the Progress bars in action"];
    [label setBackgroundColor:[UIColor clearColor]];
    [label setFont:[UIFont systemFontOfSize:12]];    
    [self.view addSubview:label];

    [super viewDidLoad];
}

- (IBAction)sliderValueChanged:(UISlider*)sender {
    for (ADVPercentProgressBar * progressBar in progressBars) {
        [progressBar setProgress:sender.value];
    }
}

 进度条之ADVProgressBar
            
    
    博客分类: iOS iPhoneiOS进度条ADVProgressBar 
最新的代码可以在GitHub进行下载:https://github.com/appdesignvault/ADVProgressBar