1,创建进度条
1 2 3 4 | var progressView= UIProgressView (progressViewStyle: UIProgressViewStyle . Default ) progressView.center= self .view.center progressView.progress=0.5 //默认进度50% self .view.addSubview(progressView); |
2,设置进度,同时有动画效果
1 | progressView.setProgress(0.8,animated: true ) |
3,改变进度条颜色
1 2 | progressView.progressTintColor= UIColor .greenColor() //已有进度颜色 progressView.trackTintColor= UIColor .blueColor() //剩余进度颜色(即进度槽颜色) |