首页 > 技术文章 > iOS开篇——UI之ProgressView(进度条)

gwkiOS 2015-11-24 01:02 原文

创建ProgressView

    UIProgressView * progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(50, 100, 200, 10)];
    
    progressView.progressViewStyle = UIProgressViewStyleDefault;
    /*
     typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
     UIProgressViewStyleDefault,     // normal progress bar
     UIProgressViewStyleBar __TVOS_PROHIBITED,     // for use in a toolbar
     };
     */
    progressView.progress = 0;
    
    
    //走过的颜色
    progressView.progressTintColor = [UIColor redColor];
    
    //本身的颜色
    progressView.trackTintColor = [UIColor greenColor];
    
    
    [self.view addSubview:progressView];

使用中 progress值改变造成进度条往前走   

推荐阅读