1

我使用“moviePlayer.duration”来查找视频的总时间,但我只得到浮点值,我如何将浮点值转换为时间格式“HH-MM-SS”

{

 duration=moviePlayer.duration;
}
4

1 回答 1

0

根据您的要求使用方法:

- (NSString *)timeFormatted:(float)totalSeconds
{
   float seconds = totalSeconds % 60; 
   float minutes = (totalSeconds / 60) % 60; 
   float hours = totalSeconds / 3600; 
   return [NSString stringWithFormat:@"%02f:%02f:%02f",hours, minutes, seconds]; 
}
于 2012-08-30T05:03:56.160 回答