//延时1s 输出
lettime=Timer(timeInterval: 1.0, repeats:false) { (timer)in
print("Timer in a block.")
}
time.fire()
//延时1s 循环输出
Timer.scheduledTimer(withTimeInterval:1.0, repeats:true) { (timer)in
print("scheduledTimer in a block")
}
//延时1s 输出
lettime=Timer(timeInterval: 1.0, repeats:false) { (timer)in
print("Timer in a block.")
}
time.fire()
//延时1s 循环输出
Timer.scheduledTimer(withTimeInterval:1.0, repeats:true) { (timer)in
print("scheduledTimer in a block")
}
本文标题:023_swift_定时器
本文链接:https://www.haomeiwen.com/subject/lyivwhtx.html
网友评论