自己写的分秒转换,用到自己做的在线音乐播放器上的



-(NSString *)changeTimeToString:(float)time
{  
    NSString* timeend;
    NSString* timestr=[NSString stringWithFormat:@"%f",time];
    int inttime=[timestr intValue];
    int minute=inttime/60;
    int second=inttime%60;
    NSString* secondstr=[NSString stringWithFormat:@"%d",second];
    if ([secondstr length]==1) 
    timeend=[NSString stringWithFormat:@"%d:0%d",minute,second];
    else 
    timeend=[NSString stringWithFormat:@"%d:%d",minute,second];
    return timeend;
}


你可能感兴趣的:(音乐,float)