任何人都可以請告訴我如何在這段代碼中顯示毫秒數?格式NSTimeInterval分鐘:秒:毫秒
-(void)updateViewForPlayerInfo:(AVAudioPlayer*)p {
countdownTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateTimeLeft)userInfo:p repeats:YES];
}
- (void)updateTimeLeft {
NSTimeInterval timeLeft = player.duration - player.currentTime;
int min=timeLeft/60;
int sec=lroundf(timeLeft) % 60;
durationLabel.text = [NSString stringWithFormat:@"-%02d:%02d",min,sec,nil];
}
這就是我所做的,它仍然以秒爲單位..例如 - 02:05.05000,02:06.0600 ...我錯過了我的計算中乘以秒的東西.... –
哦對...。我的大腦剛剛開始工作...... 05000毫秒是5秒..!Pft!...你有什麼想法我怎麼能讓這個計時器顯示每毫秒而不是1000組?例如 - 02:05.1234,02:05.1235 ...? –