UIProgressView progressTintColor bug

Hello,


in my current iOS Project I change the UIProgressView tintColor at runtime.

When I use the same color it works great, but if I use 2 different colors e.g.

"progress is less than 20 percent it becomes red else it stays in init color" it does not work.


The bug is that when I change at runtime the progressTintColor the progress bar becomes rounded corners and the actual progress does not match the current progress value. As I discribed by using the same logic and do not use a different color than the initial one it works.


Is this a known bug in iOS?


Code example:


func setBatteryProgress(value: Int) {
        batteryProgress.progress = Float(value) / 100
        if (batteryProgress.progress <= 0.2) {
            self.batteryProgress.progressTintColor = UIColor.red
           //when I use here same color as in the else block it works
        } else {
            batteryProgress.progressTintColor = primaryColor
           //when I use here same color as in the if block it works
        }
}


Strange behavior -> the progress is at a random value, and the left corner of the progress bar is rounded.


Some has an idea about this?


Greetings


Tobias

It occurs when the height of progressbar > 10.

UIProgressView progressTintColor bug
 
 
Q