17

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 Answers5

44

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.. :)

Rashad
  • 11,057
  • 4
  • 45
  • 73
5

In Swift, you can do it like this:

progressView.progressTintColor = UIColor.yellowColor()
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211
4

Swift 5:

progressBar.tintColor = UIColor(red: 33/255.0, green: 150/255.0, blue: 243/255.0, alpha: 1)
progressBar.tintColor = .blue
Zouhair Sassi
  • 1,403
  • 1
  • 13
  • 30
1

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)];
-1

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.

bfontaine
  • 18,169
  • 13
  • 73
  • 107
  • 1
    Welcome. 1. The question is asking how to set the color of the progress bar. Your answer does not apply to the question being asked. 2. Do not post pictures of code. Copy and paste code as actual text into the answer. 3. You can delete your answer since it does not apply to the question. – HangarRash Mar 29 '23 at 14:55