How to set the progress tint color in UIProgressView

24.8k Views Asked by At

I would like to know how to set UIProgressView tint color. Sometimes, depending on the color, the default height does not allow to see properly the progress. How to fix that issue?

5

There are 5 best solutions below

1
On BEST ANSWER

This is for me the optimal way to do it:

[progress setProgressTintColor:UIColorFromRGB(0xaa0000)];

where UIColorFromRGB is:

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

(OPTIONAL): Sometimes, depending on the color, the progress is not properly appreciated and is necessary to increase the progress bar height:

[progress setTransform:CGAffineTransformMakeScale(1.0, 3.0)];
0
On

You can set tint color of track and progress bar by this;

For track color:

progress.trackTintColor = [UIColor whiteColor]; 

Progress bar:

progress.progressTintColor = [UIColor redColor];

Hope this helps.. :)

2
On

Swift 5:

progressBar.tintColor = UIColor(red: 33/255.0, green: 150/255.0, blue: 243/255.0, alpha: 1)
progressBar.tintColor = .blue
1
On

you can just use progressBar name (.) operation and progress property

for example : progressBar.progress = 0.1 or whatever you want to give a value it should be float we can change the progress tint colour with the help of this.

try to understand with the help of the piece of code I shared here.

0
On

In Swift, you can do it like this:

progressView.progressTintColor = UIColor.yellowColor()