【发布时间】:2021-06-30 07:25:26
【问题描述】:
代码:
var timerCount: Int = 15
hideTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { (timer) in
self.timerCount -= 1
print(self.timerCount)
if self.timerCount <= 0 {
if self.hideTimer != nil {
self.hideTimer.invalidate()
self.hideTimer = nil
}
}
})
print 语句只是继续打印成负数 =(
这发生在 UITableViewCell 中,如果这很重要的话。
我做错了什么?
【问题讨论】:
标签: ios swift xcode timer counter