I want to represent a countdown timer. The progress view should change color for <70% - Yellow, <50% -red. But UIProgressView
doesn't update after changing ProgressTintColor.(For 0 < x < 0.5).
But It works fine when I comment
[self.progressView setProgressTintColor: [UIColor redColor]]; //this line.
The below code will Trigger for each second:
float value = (float)secondsLeft / (float)secTotalDuration;
if (value < 0.9) {
if (isChange == NO) {
//[self.progressView setTranslatesAutoresizingMaskIntoConstraints: NO]; //- I tried THIS.
[self.progressView setProgressTintColor: [UIColor redColor]]; //LINE - #1
[self.progressView setTrackTintColor: [UIColor clearColor]];
isChange = YES;
}
dispatch_async(dispatch_get_main_queue(), ^{ //With or without mainqueue doen't affect Uiprogressview change while commenting LINE - #1
[self.progressView setProgress:value animated:NO];
});
NSLog(@"Progress: %f", [self.progressView progress]);
And LOG:
Progress: 1.000000
Progress: 0.800000
Progress: 0.700000
Progress: 0.500000 //Doesn't updated after this.
Progress: 0.300000
Progress: 0.200000