以下所有值都是双精度值,但 switch 需要一个整数值。有没有办法解决?
switch(fivePercentValue){
case floor((5*fivePercentValue) / 100):
fivePercent_.backgroundColor = [UIColor greenColor];
fivePercentLabel_.textColor = [UIColor greenColor];
break;
case ceil((5*fivePercentValue) / 100):
fivePercent_.backgroundColor = [UIColor greenColor];
fivePercentLabel_.textColor = [UIColor greenColor];
break;
default:
fivePercent_.backgroundColor = [UIColor redColor];
fivePercentLabel_.textColor = [UIColor redColor];
break;