Reputation: 33
I have Label in my UIView which continuously changes values in between 80(min) to 475(Max) now I have run the progress bar status with respect to max and min value of label continuously. below where the code i have tried till now
if ampsMaxValue <= 80
{
ampsMaxValue = 80
ampsLabel.text = String(ampsMaxValue)
ampsprogressBar.progress = Float(0)
return
}
ampsMaxValue = ampsMaxValue - 1
ampsLabel.textColor = UIColor.white
ampsprogressBar.tintColor = UIColor.red
ampsLabel.text = String(ampsMaxValue)
v -= 0.1
ampsprogressBar.progress = Float(v)
}else{
if ampsMaxValue >= 475
{
ampsMaxValue = 475
ampsLabel.text = String(ampsMaxValue)
ampsprogressBar.progress = Float(1)
return;
}
ampsMaxValue = ampsMaxValue + 1
ampsLabel.textColor = UIColor.white
ampsprogressBar.tintColor = UIColor.red
ampsLabel.text = String(ampsMaxValue)
v += 0.1
ampsprogressBar.progress = Float(v)
}
I was able show the increased and decreased value by 0.1, but not solved it. need info about how calculate the exact increased and decreased value for the progress bar with respect to the label max an min value.
Upvotes: 1
Views: 1462