Update VolumeSlider.m
Fix variable declaration
This commit is contained in:
parent
f2ed595cda
commit
8a06f2ad1c
1 changed files with 4 additions and 3 deletions
|
@ -63,16 +63,17 @@ static void *kVolumeSliderContext = &kVolumeSliderContext;
|
||||||
double value = [self doubleValue];
|
double value = [self doubleValue];
|
||||||
double volume;
|
double volume;
|
||||||
volume = linearToLogarithmic(value, MAX_VOLUME);
|
volume = linearToLogarithmic(value, MAX_VOLUME);
|
||||||
|
NSString *text;
|
||||||
|
|
||||||
// If volume becomes less than 1%, display two decimal digits of precision (e.g. 0.34%).
|
// If volume becomes less than 1%, display two decimal digits of precision (e.g. 0.34%).
|
||||||
if(volume < 1)
|
if(volume < 1)
|
||||||
NSString *text = [NSString stringWithFormat:@"%0.2lf%%", volume];
|
text = [NSString stringWithFormat:@"%0.2lf%%", volume];
|
||||||
// Else if volume becomes less than 10%, display one decimal digit of precision (e.g. 3.4%).
|
// Else if volume becomes less than 10%, display one decimal digit of precision (e.g. 3.4%).
|
||||||
else if(volume < 10)
|
else if(volume < 10)
|
||||||
NSString *text = [NSString stringWithFormat:@"%0.1lf%%", volume];
|
text = [NSString stringWithFormat:@"%0.1lf%%", volume];
|
||||||
// Else display no decimal digits.
|
// Else display no decimal digits.
|
||||||
else
|
else
|
||||||
NSString *text = [NSString stringWithFormat:@"%0.lf%%", volume];
|
text = [NSString stringWithFormat:@"%0.lf%%", volume];
|
||||||
|
|
||||||
[textView setString:text];
|
[textView setString:text];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue