override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.timerAction(_:)), userInfo: "Apple", repeats: true)
}
@objc func timerAction(_ timer:Timer) {
let parameter = timer.userInfo
print("I am eating \(parameter!).")
}
Xcode9学习笔记78 - 使用Timer执行定时任务
猜你喜欢
转载自blog.csdn.net/u011728344/article/details/78692543
今日推荐
周排行