20160908

计时



NSMutableString * timeStr = [NSMutableString string ];
    NSInteger duration = model.video.duration ;
    if (duration > 3600) {
        [ timeStr appendFormat: @"%02ld:" , duration/3600  ] ;
        duration = duration % 3600 ;
    }
    
    if ( duration > 60 ){
        [timeStr appendFormat:@"%02ld:", duration / 60  ];
        duration = duration % 60;
    }
    
      [timeStr appendFormat: @"%2ld:", duration ];
    /*
    if (model.video.duration > 3600) {
        [timeStr appendFormat: @"%2ld:", model.video.duration/3600 ];
    }
    if (model.video.duration > 60 ) {
        NSInteger minuteNum = model.video.duration ;
        if (minuteNum > 3600){
            minuteNum = minuteNum % 3600;
        }
        [timeStr appendFormat: @"%02ld: ", minuteNum/60 ];
    }
    model.top_comments
    */

    self.playTimeLabel.text = timeStr;

你可能感兴趣的:(20160908)