So I am using UISlider for an Audio Player's scrubber. What I am attempting to do is update a label whenever a UISlider's value is changed so that it can properly display the current audio's time elapsed in minutes and seconds. Here is my current code:
- (IBAction)valueChanged:(id)sender {
if (!self.scrubbing) {
[[CRAudioUtility sharedUtility]seekToTime:self.progressSlider.value];
NSInteger value = [CRAudioUtility sharedManager].currentPlaybackTime;
NSInteger minutes = value / 60;
NSInteger seconds = value % 60;
NSString *time_stamp = [NSString stringWithFormat:@"%d hours:%d minutes",minutes,seconds];
[self.progressSlider setAccessibilityValue:time_stamp];
self.progressSliderLabel.text = [NSString stringWithFormat:@"%d:%d minutes",minutes,seconds;
}
}
Audio items may or may not be longer than an hour, and the length may be more than one hour.
Since the accessibilityLabel is announced, I need to ensure that the word "hour" is announced properly in their singular or plural format. What kind of solutions can I do to handle this case?