我是新来的编码(和本网站),我正尝试使用YouTube上的教程构建秒表,并且无法使其工作。当我编写更新Timer的函数时,错误“%is unavailable:instead truncatingRemainder instead”显示在第6行和第7行。我正在使用最新的Xcode版本编码Swift的最新版本。有人能告诉我如何让它与毫秒一起使用truncatingRemainder吗?对此,我真的非常感激。我该如何摆脱“%is unavailable:Use truncatingRemainder instead”?
这里是链接到教程:https://www.youtube.com/watch?v=xp0dvmvh3Cw
func updateElapsedTimeLabel (timer : Timer)
{
if watch.isRunning
{
let minutes = Int(watch.elapsd/60)
let seconds = Int(watch.elapsd % 60)
let ten0fseconds = Int(watch.elapsd * 10 % 10)
elapsedTimeLabel.text = String (format: "%2d:%2d.%2d", minutes, seconds, ten0fseconds)
}
else {
timer.invalidate()
}
}
错误消息告诉您该怎么办... –
@代码学徒我知道它告诉我,但我想知道它为什么不起作用。 – Brandon