swift 3.0 定时器Timer

各个版本的定时器用法已经写好

//Swift 3 
var timer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(self.update), userInfo: nil, repeats: true); 
//Swift 2.2~2.3 
var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: #selector(MyClass.update), userInfo: nil, repeats: true) 
//Swift <2.2 
var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: "update", userInfo: nil, repeats: true)

你可能感兴趣的:(swift 3.0 定时器Timer)