通常在录像时需要显示录了多久,可以设定一个Timer计时器数秒,再把秒数转换为时间显示
@objc func showRecodeTime() {recordTimeNum += 1var str = ""var num = recordTimeNumif num > 3599 {str = num / 3600 < 10 ? "0\(num/3600)" : "\(num/3600)"num = recordTimeNum % 3600} else {str = "00"}if num > 59 {str = num / 60 < 10 ? str+":0\(num/60)" : str+":\(num/60)"num = recordTimeNum % 60} else {str = "00:00"}str = num < 10 ? str+":0\(num)" : str+":\(num)"videoTimeLabel.text = str}