iOS控件--UIProgressView--进度条控件

UIProgressView,也就是进度条,我们经常会在下载的时候看到这个控件。

初始化 UIProgressView

     //进度条高度不可修改
        UIProgressView *progress = [[UIProgressView alloc] initWithFrame:CGRectMake(100, 100, 200, 40)];
        
        //设置进度条的颜色
        progress.progressTintColor = [UIColor blueColor];
        
        //设置进度条的当前值,范围:0~1;
        progress.progress = 0.5;
        
        /*
         typedef NS_ENUM(NSInteger, UIProgressViewStyle) {
         UIProgressViewStyleDefault,     // normal progress bar
         UIProgressViewStyleBar __TVOS_PROHIBITED,     // for use in a toolbar
         };
        */
        progress.progressViewStyle = UIProgressViewStyleDefault;

在需要使用的地方不断的修改 .progress 属性值即可。

以上是对 UIProgressView 控件的描述和使用,不以偏概全,只授之以渔,有更好的操作也会及时更新。如果您有 UIProgressView 控件的更好使用欢迎留言交流!

你可能感兴趣的:(iOS控件--UIProgressView--进度条控件)