我需要配置一個十進制值,以便它顯示從1 - 100浮點數,如12.34。現在,它只顯示0到1之間的浮點數,所以我得到0.12。需要移動浮點值的小數點
如何進行更改,使小數點右移兩位?
這是在Xcode 4.2適用於iOS的方法的代碼:
- (IBAction)sliderMoved:(UISlider *)slider
{
NSLog(@"The value of the slider is now: %.2f", slider.value);
}
我需要配置一個十進制值,以便它顯示從1 - 100浮點數,如12.34。現在,它只顯示0到1之間的浮點數,所以我得到0.12。需要移動浮點值的小數點
如何進行更改,使小數點右移兩位?
這是在Xcode 4.2適用於iOS的方法的代碼:
- (IBAction)sliderMoved:(UISlider *)slider
{
NSLog(@"The value of the slider is now: %.2f", slider.value);
}
你不能乘以100的價值?
NSLog(@"The value of the slider is now: %.2f", slider.value*100);
乘以100? – beryllium